07-Manual Search in Oracle OAF

 Make sure you have setup your jDeveloper properly and created OAWorkspace. In case you have not done that before, click here to see how.

Click here to know different types of search pages in OAF.

Below are the steps in brief:

  • Create Application Module (AM)
  • Create View Object (VO)
  • Add VO to AM
  • Create a page
  • Add search fields to the page layout 
  • Add Table Region to the page
  • Add function in Application Module Java file (Impl) to set the where clause dynamically
  • Invoke the Application Module function from controller file

We will add new package (manualsearch as subcomponent of component demo) in our previous application workspace. For detailed tutorial on adding all the business components view the previous post here. 


  • Add the ManualSearchAM 




  • Add the ManualSearchVO using the below query

SELECT
    ooha.header_id,
    ooha.order_number,
    ooha.cust_po_number,
    ooha.ordered_date,
    ooha.org_id,
    hou.name org_name
FROM
    oe_order_headers_all  ooha,
    hr_operating_units    hou
WHERE
    ooha.org_id = hou.organization_id







  • Add ManualSearchVO to ManualSearchAM




  • Add ManualSearchPG

  • Set below properties of Page Layout Region of the page

  • Add new region inside PageLayoutRN and change the style to messageComponentLayout

  • Inside SearchRN add two messageTextInput fields OrderNumberTxt and OrgNameTxt . Also add the prompt for these fields.

  • Add messageLayout inside SearchRN and two submitButton items




  • Right click SearchRN and select New -> Region Using Wizard


  • Set the Region Id as ResultTable and Region Style as table

  • Select all the attributes


  • Select the ManualSearchAM and then select ManualSearchVO


  • Select Style of each attribute as messageStyledText






  • Right click SearchRN and select Set New Controller and add the controller file


  • Write the below code in the controller file's processFormRequest method
package oracle.apps.cie.demo.manualsearch.webui;

import java.io.Serializable;

import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.webui.OAControllerImpl;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;

/**
 * Controller for ...
 */
public class ManualSearchCO extends OAControllerImpl
{
  public static final String RCS_ID="$Header$";
  public static final boolean RCS_ID_RECORDED =
        VersionInfo.recordClassVersion(RCS_ID, "%packagename%");

  /**
   * Layout and page setup logic for a region.
   * @param pageContext the current OA page context
   * @param webBean the web bean corresponding to the region
   */
  public void processRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    super.processRequest(pageContext, webBean);
  }

  /**
   * 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);
    
    OAApplicationModule am=(OAApplicationModule)pageContext.getApplicationModule(webBean);
    
    //Below code will be executed when GoBtn is clicked
    if(pageContext.getParameter("GoBtn")!=null){
        String orderNumber=pageContext.getParameter("OrderNumberTxt");
        String orgName=pageContext.getParameter("OrgNameTxt");
        
        //Serialize the parameters to send to Application Module Impl file
        Serializable params[]={orderNumber,orgName};
        
        //Call the Application Module Impl file's function
        am.invokeMethod("filterOrder",params);
    }

  }

}



  • Click the ManualSearchAM in the structure window and open the file ManualSearchAMImpl.java. This is the implementation file of the application module.

  • Add the below code in ManualSearchAMImpl.java file
package oracle.apps.cie.demo.manualsearch.server;

import oracle.apps.fnd.framework.server.OAApplicationModuleImpl;
// ---------------------------------------------------------------------
// ---    File generated by Oracle ADF Business Components Design Time.
// ---    Custom code may be added to this class.
// ---    Warning: Do not modify method signatures of generated methods.
// ---------------------------------------------------------------------
public class ManualSearchAMImpl extends OAApplicationModuleImpl {
    /**This is the default constructor (do not remove)
     */
    public ManualSearchAMImpl() {
    }

    /**Sample main for debugging Business Components code using the tester.
     */
    public static void main(String[] args) {
        launchTester("oracle.apps.cie.demo.manualsearch.server"/* package name */
      "ManualSearchAMLocal" /* Configuration Name */);
    }

    /**Container's getter for ManualSearchVO
     */
    public ManualSearchVOImpl getManualSearchVO() {
        return (ManualSearchVOImpl)findViewObject("ManualSearchVO");
    }
    
    public void filterOrder(String orderNumber,String orgName){
        //Get Handle of the view object
        ManualSearchVOImpl manualSearchVo=getManualSearchVO();
        
        //Set where clause to the view object
        manualSearchVo.setWhereClause("order_number = nvl(:1,order_number) and org_name = nvl(:2,org_name) ");
        
        //Set the where clause parameters 
        manualSearchVo.setWhereClauseParam(0,orderNumber);
        manualSearchVo.setWhereClauseParam(1,orgName);
        
        //Execute this where clause now
        manualSearchVo.executeQuery();
    } 
}



In case you don't want to write the code in the Application Module Impl file, use the below code to perform same operation via Controller File only

/*===========================================================================+
 |   Copyright (c) 2001, 2005 Oracle Corporation, Redwood Shores, CA, USA    |
 |                         All rights reserved.                              |
 +===========================================================================+
 |  HISTORY                                                                  |
 +===========================================================================*/
package oracle.apps.cie.demo.manualsearch.webui;

import java.io.Serializable;

import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.OAViewObject;
import oracle.apps.fnd.framework.webui.OAControllerImpl;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;

/**
 * Controller for ...
 */
public class ManualSearchCO extends OAControllerImpl {
    public static final String RCS_ID = "$Header$";
    public static final boolean RCS_ID_RECORDED = 
        VersionInfo.recordClassVersion(RCS_ID, "%packagename%");

    /**
     * Layout and page setup logic for a region.
     * @param pageContext the current OA page context
     * @param webBean the web bean corresponding to the region
     */
    public void processRequest(OAPageContext pageContext, OAWebBean webBean) {
        super.processRequest(pageContext, webBean);
    }

    /**
     * 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);
        OAApplicationModule am = (OAApplicationModule)pageContext.getApplicationModule(webBean);

        //Below code will be executed when GoBtn is clicked
        if (pageContext.getParameter("GoBtn") != null) {
            String orderNumber = pageContext.getParameter("OrderNumberTxt");
            String orgName = pageContext.getParameter("OrgNameTxt");

            OAViewObject manualSearchVo = (OAViewObject)am.findViewObject("ManualSearchVO");

            //Set where clause to the view object
            manualSearchVo.setWhereClause("order_number = nvl(:1,order_number) and org_name = nvl(:2,org_name) ");

            //Set the where clause parameters 
            manualSearchVo.setWhereClauseParam(0, orderNumber);
            manualSearchVo.setWhereClauseParam(1, orgName);

            //Execute this where clause now
            manualSearchVo.executeQuery();

        }
    }

}

  • Use the below code for Clear Button in processFormRequest method of the controller file
    //Below code will be executed when CancelBtn is clicked
    if (pageContext.getParameter("CancelBtn") != null) {
        OAMessageTextInputBean orderNumberTxt=(OAMessageTextInputBean)webBean.findChildRecursive("OrderNumberTxt");
        orderNumberTxt.setValue(pageContext,null);
        
        OAMessageTextInputBean orgNameTxt=(OAMessageTextInputBean)webBean.findChildRecursive("OrgNameTxt");
        orgNameTxt.setValue(pageContext,null);
    }
  • Save all the work and right click ManualSearchPG to run the page


Comments

All Categories

Call Fusion BIP Report2 Change Password1 Code Combinations2 Compute Instance2 CTE1 Customer1 Data Aggregation2 Database5 Date Conversion1 DB Adapter2 Decryption1 Development1 EBS4 Encryption1 ESS Jobs3 Examine1 FBDI3 Fusion APIs1 Fusion BIP7 GIT2 GL3 GL Journals1 GL_DAILY_CONVERSION_TYPES1 GL_DAILY_RATES1 ICS1 Identity Domain1 Integrations1 Java1 Journal Import1 Keys1 Legal Entity1 LookupTypeLOV1 LOV1 LOVs1 MultiPartAPIs1 Networking1 NVL2 NVL in OIC2 OCI11 OCI Billing1 OCI Compute5 OCI Cost Management1 OCI Events Service1 OCI Free Tier3 OCI Notifification Service1 OCI Security3 OIC4 OIC Mapper2 Oracle26 Oracle ADF17 Oracle APEX1 Oracle Apps59 Oracle Apps R126 Oracle ATP1 Oracle BIP8 Oracle Cloud12 Oracle Cloud Free Tier1 Oracle cloud Infrastructure9 Oracle Cloud Security2 Oracle Cloud VM1 Oracle DB4 oracle ebs5 Oracle ERP4 Oracle ERP Adapter2 Oracle ERP Cloud7 Oracle financials2 Oracle Forms1 Oracle Fusion57 Oracle Fusion BIP4 Oracle Fusion ERP17 Oracle Fusion Financials18 Oracle Integration Cloud3 Oracle OAF17 Oracle OCI14 Oracle OIC22 Oracle SOA 12c10 Oracle SQL17 Oracle VBCS1 Oracle VBS2 Oracle Visual Builder Cloud Service1 Oracle Visual Builder Studio2 Oracle Workflow Notifications1 Others10 Payables2 Payables Import1 Properties1 R121 Register BIP as ESS Job1 Reset Password1 Responsibility1 REST4 Security List1 Site Map1 SOAP2 SOAP API2 SOAP UI3 SQL16 SQL Functions3 SQL Queries14 SQL Query8 SQL Tips3 SSH1 TCA1 Value Sets1 VBCS1 Virtual Machine2 Virtual Machines1 XML1 XSLT1
Show more