OA Framework – How to call Application Module Methods from Controller class

If we want to call any method of Application Module from Controller class in OA Framework there are two ways to achieve this:

  1. Using invokeMethod: invokeMethod is the method of OAApplicationModule class it takes three parameters:
    • Method Name- Data Type String
    • Parameters(Optional)- array of type Serializable
    • paramTypes(Optional)- array of datatypes, one to one mapping with parameters.

 Example:

 OAApplicationModule am = pageContext.getApplicationModule(webBean);

Boolean executeQuery = BooleanUtils.getBoolean(false);

String s3 = pageContext.getParameter(“auctionHeaderId”);

Serializable parameters[] = {s3, executeQuery};

Class paramTypes[] = {String.class, Boolean.class};

am.invokeMethod(“initSummary”, parameters, paramTypes); 

  1. Creating an Interface of Application Module: This method is useful if we have to pass serializable parameters to AM. In this case first we need to create an interface for Application module:

Following are the steps to create Interface of Application Module: 

Step 1: Select required AM, right click, from context menu select edit <AMName>

Step 2: Select Client Method option 

If we want to call any method of Application Module from Controller class there are two ways to achieve this:

  1. Using invokeMethod: invokeMethod is the method of OAApplicationModule class it takes three parameters:
    • Method Name- Data Type String
    • Parameters(Optional)- array of type Serializable
    • paramTypes(Optional)- array of datatypes, one to one mapping with parameters.

Example:

 

OAApplicationModule am = pageContext.getApplicationModule(webBean);

Boolean executeQuery = BooleanUtils.getBoolean(false);

String s3 = pageContext.getParameter(“auctionHeaderId”);

Serializable parameters[] = {s3, executeQuery};

Class paramTypes[] = {String.class, Boolean.class};

am.invokeMethod(“initSummary”, parameters, paramTypes);

 

  1. Creating an Interface of Application Module: This method is useful if we have to pass serializable parameters to AM. In this case first we need to create an interface for Application module

Following are the steps to create Interface of Application Module:

Step 1: Select required AM, right click, from context menu select edit <AMName>

 

1

  

 

  Step 2: Select Client Method option

2

 

Step 3: In above figure you are able to see methods under available select required methods (methods you want to call without using invokeMethod) and move those to right side and click on Apply and OK.

3

After this step, Jdeveloper will create one java file name of AM, you can see this Object Navigator:

4

Contents of that file will be:

package xxbc.oracle.apps.icx;

import oracle.jbo.ApplicationModule;

//  —————————————————————

//  —    File generated by Oracle Business Components for Java.

//  —————————————————————

/**

 *

 * Generated interface. Do not modify.

 */

public interface EmpAM extends ApplicationModule

{

  void deleteEmpMethod(String pEmpId);

  void createEmpMethod();

  void createEmp();

  void updateEmpMethod(String pEmpId);

  void saveEmpToDatabase();

  void rollbackToDatabase();

}

Now to call these methods from your controller you need to add following things to your controller class:

  • Import package which contains your Application Module definition to controller class e.g.

           Import xxx.oracle.apps.xxx.server;

  • Create an object of your Application module

XXEGAAwardByQuoteAM xxegaawardbyquoteam = (XXEGAAwardByQuoteAMImpl)pageContext.getApplicationModule(webBean);

Where XXEGAAwardByQuoteAM is Interface class of Application module XXEGAAwardByQuoteAM.

  • Call your method like:

<AMObject>.<method>

Example:

Import XXEGA.oracle.apps.pon.awardbyqt.server.XXEGAAwardByQuoteAMImpl;

processFormRequest(….)

{

XXEGAAwardByQuoteAMImpl xxegaawardbyquoteam = (XXEGAAwardByQuoteAMImpl)pageContext.getApplicationModule(webBean);

Number s5 = xxegaawardbyquoteam.get_msgCount();

} 

Contents of that file will be:

 

package xxbc.oracle.apps.icx;

import oracle.jbo.ApplicationModule;

//  —————————————————————

//      File generated by Oracle Business Components for Java.

//  —————————————————————

/**

 *

 * Generated interface. Do not modify.

 */

 

public interface EmpAM extends ApplicationModule

{

  void deleteEmpMethod(String pEmpId);

  void createEmpMethod();

  void createEmp();

  void updateEmpMethod(String pEmpId); 

  void saveEmpToDatabase();

  void rollbackToDatabase();

}

Now to call these methods from your controller you need to add following things to your controller class:

·        Import package which contains your Application Module definition to controller class e.g.

           Import xxx.oracle.apps.xxx.server;

 

·        Create an object of your Application module

XXEGAAwardByQuoteAM xxegaawardbyquoteam = (XXEGAAwardByQuoteAMImpl)pageContext.getApplicationModule(webBean);

Where XXEGAAwardByQuoteAM is Interface class of Application module XXEGAAwardByQuoteAM.

 

·        Call your method like:

<AMObject>.<method>

Example:

Import XXEGA.oracle.apps.pon.awardbyqt.server.XXEGAAwardByQuoteAMImpl;

processFormRequest(….)

{

XXEGAAwardByQuoteAMImpl xxegaawardbyquoteam = (XXEGAAwardByQuoteAMImpl)pageContext.getApplicationModule(webBean);

Number s5 = xxegaawardbyquoteam.get_msgCount();

}

About Ritesh

• Around 4 years of IT experience in Oracle based projects. • Over 3 years of experience in Oracle Applications(ERP and CRM) in various modules in Manufacturing (PO,OM,), Oracle Sourcing and Trading community Architecture, AOL, Oracle Alerts. • Currently working with Blink Consulting Pvt. Ltd., Pune as Consultant, Since 26th May, 2008 • Previously worked for reputed organizations like Wipro Technologies and HCL Infosystems. Proficiency in Oracle Application architecture with exposure to solution design, coding and implementation using AIM methodology. • Wide experience in OAF Forms (Java based), Forms Personalization, Reports, Interfaces, Data Migration and conversion, XML Publisher, Workflow and Oracle Forms Customizations and development in Oracle E-Business suite in particular. • Experience of all the vital steps of SDLC.
This entry was posted in OA Framework. Bookmark the permalink.

1 Response to OA Framework – How to call Application Module Methods from Controller class

  1. Pingback: 2010 in review « Dinesh Nair's Oracle EBS Blog

Leave a comment