Sunday, November 06, 2016

OAF -How to get the current page name

OAF - CO Extension - Find the page name at run time.

I have come across a requirement for which i have to perform CO extension.

But there are two pages involved in which both of them are using same CO.

But i have to write a different logic for the pages.

So i have used the below logic to identify the page and wrote the logic accordingly.


Hope the below code helps..


//Code to get the page Name.


    String pageURL = pageContext.getCurrentUrl ();
    int lastIndex  = pageURL.lastIndexOf( '/' );;
    String finalPageNameStr = pageURL.substring(lastIndex + 1, pageURL.indexOf("&"));
    pageContext.writeDiagnostics(this,"Final Page Name -->" + finalPageNameStr,1);



  if (finalPageNameStr!=null && "pageNameA".equals(finalPageNameStr))
    {
 pageContext.writeDiagnostics(this," Inside Page A logic ",1);

}
 else  if (finalPageNameStr!=null && "pageNameB".equals(finalPageNameStr))
   {
  pageContext.writeDiagnostics(this," Inside Page B logic ",1);  
}







Friday, October 28, 2016

OAF - Set FireAction for DropDown Dynamically



  public void processRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    super.processRequest(pageContext, webBean);
   
      super.processRequest(pageContext, webBean);
      AMCGBizzSericesAMImpl am = (AMCGBizzSericesAMImpl)pageContext.getApplicationModule(webBean);
      am.initEmpEOVO();
     
      System.out.println("PR Method of Main page RN");
     
      OAMessageChoiceBean deptPopIDBean = (OAMessageChoiceBean)webBean.findIndexedChildRecursive("deptPopID");
      deptPopIDBean.setFireActionForSubmit("DeptPop_EVENT",null,null,true);
  }

  /**
   * Procedure to handle form submissions for form elements in
   * a region.
   * @param pageContext the current OA page context
   * @param webBean the web bean corresponding to the region
   */
  public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    super.processFormRequest(pageContext, webBean);
   
      System.out.println("PFR Method of Main Page  RN");
     
      String eventParam = pageContext.getParameter(EVENT_PARAM);
       if(eventParam!=null && "DeptPop_EVENT".equals(eventParam))
        {
         throw new OAException("User Clicked on PopEvent");
        }
     
   
     
  }

Thursday, October 27, 2016


Oracle Cloud - Invoking REST Webservice (HCM Module)

Invoking REST web service Using: Advanced REST client (in chrome)

REST WebService URL : https://rws2-fapxxx-hcm.oracledemos.com/hcmCoreApi/resources/11.1.11/emps//?q=PersonNumber=715










Invoking REST  WebService using SOAP REST Client.



OAF Page Controller Flow , When Multiple CO's  are there.


Events are handled from mainRN to child RN.

Following is the log snippet for the same.


--Process Request Method
PR Method of Main Page  RN
PR Method of Shared RN



-- Process Form Request Method
PFR Method of Main Page  RN
PFR Method of Shared RN

Friday, September 30, 2016

OAF- Query to list all personalizations


Following query can be used to list all the personalizations of OAF using MDS Repository.

**But the problem with the below one, we cant be sure personalizations which are done by the business and as well as personalizations (vanilla) which are provided by oracle

*CREATED_BY column does not have any info any significance to validate if it is provided by oracle or done by business.

*business means : customization's done by developer for custom requirements.

select
jp.created_by,
jp.path_name, jp.path_docid
, jdr_mds_internal.getdocumentname(jp.path_docid) page_path
from jdr_paths jp where 1=1
AND jp.path_type='DOCUMENT'
AND jdr_mds_internal.getdocumentname(jp.path_docid)  like '/oracle/apps/%custo%'

Monday, July 18, 2016

Oracle AP Invoice Aging Report Query
------------------------------------------------

SELECT   org_name,
              vendor_name,
              vendor_number,
              vendor_site_details,
              invoice_number,
              invoice_date,
              gl_Date,
              invoice_type,
              due_date,
              past_due_days,
              amt_due_remaining,
              CASE
                 WHEN past_due_days >= -999 AND past_due_days < 0
                 THEN
                    amt_due_remaining
                 ELSE
                    0
              END
                 CURRENT_BUCKET,
              CASE
                 WHEN past_due_days >= 0 AND past_due_days <= 30
                 THEN
                    amt_due_remaining
                 ELSE
                    0
              END
                 BUCKET_0_30,
              CASE
                 WHEN past_due_days > 30 AND past_due_days <= 60
                 THEN
                    amt_due_remaining
                 ELSE
                    0
              END
                 BUCKET_31_60,
              CASE
                 WHEN past_due_days > 60 AND past_due_days <= 90
                 THEN
                    amt_due_remaining
                 ELSE
                    0
              END
                 BUCKET_61_90,
              CASE
                 WHEN past_due_days > 90 AND past_due_days <= 120
                 THEN
                    amt_due_remaining
                 ELSE
                    0
              END
                 BUCKET_91_120,
              CASE
                 WHEN past_due_days > 120 AND past_due_days <= 999999
                 THEN
                    amt_due_remaining
                 ELSE
                    0
              END
                 GREATER_THAN_120
       FROM   (SELECT   hou.name org_name,
                        pv.vendor_name vendor_name,
                        pv.segment1 vendor_number,
                        pvs.vendor_site_code || ' ' || pvs.city || ' ' || state
                           vendor_site_details,
                        i.invoice_num invoice_number,
                        i.payment_status_flag,
                        i.invoice_type_lookup_code invoice_type,
                        i.invoice_date Invoice_Date,
                        i.gl_date Gl_Date,
                        ps.due_date Due_Date,
                        (CEIL (SYSDATE - ps.due_date)) past_due_days, -- DAYS_DUE,
                        DECODE (
                           i.invoice_currency_code,
                           'USD',
                           DECODE (
                              0,
                              0,
                              ROUND (
                                 ( (NVL (ps.amount_remaining, 0)
                                    / (NVL (i.payment_cross_rate, 1)))
                                  * NVL (i.exchange_rate, 1)),
                                 2
                              ),
                              ROUND( ( (NVL (ps.amount_remaining, 0)
                                        / (NVL (i.payment_cross_rate, 1)))
                                      * NVL (i.exchange_rate, 1))
                                    / 0)
                              * 0
                           ),
                           DECODE (
                              i.exchange_rate,
                              NULL,
                              0,
                              DECODE (
                                 0,
                                 0,
                                 ROUND (
                                    ( (NVL (ps.amount_remaining, 0)
                                       / (NVL (ps.payment_cross_rate, 1)))
                                     * NVL (i.exchange_rate, 1)),
                                    2
                                 ),
                                 ROUND( ( (NVL (ps.amount_remaining, 0)
                                           / (NVL (i.payment_cross_rate, 1)))
                                         * NVL (i.exchange_rate, 1))
                                       / 0)
                                 * 0
                              )
                           )
                        )
                           amt_due_remaining
                 FROM   ap_payment_schedules_all ps,
                        ap_invoices_all i,
                        ap_suppliers pv,
                        ap_supplier_sites_all pvs,
                        ap_lookup_codes alc1,
                        hr_operating_units hou
                WHERE       i.invoice_id = ps.invoice_id
                        AND i.vendor_id = pv.vendor_id
                        AND i.vendor_site_id = pvs.vendor_site_id
                        AND i.org_id = hou.organization_id
                        AND i.cancelled_date IS NULL
                        --AND ps.amount_remaining = 0
                        AND (NVL (ps.amount_remaining, 0)
                             * NVL (i.exchange_rate, 1)) != 0
                        AND i.payment_status_flag IN ('N', 'P')
                        AND alc1.lookup_type(+) = 'INVOICE TYPE'
                        AND alc1.lookup_code(+) = i.invoice_type_lookup_code
                        --and    i.INVOICE_NUM ='358908411'
                        AND ap_invoices_pkg.get_approval_status (
                              i.invoice_id,
                              i.invoice_amount,
                              ps.payment_status_flag,
                              invoice_type_lookup_code
                           ) in('APPROVED','NEEDS REAPPROVAL'))
--                        AND i.org_id = fnd_profile.VALUE ('ORG_ID'))
where 1=1
ANd vendor_name IN ( 'Advantage Corp' ,'Capp Consulting' )
and invoice_number IN ('18-JAN-2007','AC0904','22-JUN-2007','25-JUL-2007')
   ORDER BY   2;

Wednesday, July 13, 2016

Oracle ERP Cloud - Invoke HCM REST WebService Using CURL


URL For List of HCM REST WebServices : https://docs.oracle.com/cloud/latest/jcs_gs/JSRMR/Use%20cURL.html


Command to invoke REST WebService

curl -i -u "<username>:<password>" -X GET https://<host>:<port>/hcmCoreApi/resources/latest/emps/
  Example :   curl  -k -i -u "CASEY.BROWN:Password" -X GET https://rws2-<xxno>-hcm.oracledemos.com/hcmCoreApi/resources/11.1.11/emps/

curl  -k -i -u "CASEY.BROWN:Password" -X GET https://rws2-<xxno>-hcm.oracledemos.com/hcmCoreApi/resources/11.1.11/emps//?q=PersonNumber=715

Following is the output :