<-----Google Analytics Code Start----> <-----Google Analytics Code Close---->
Skip to content

Green

color

Default screen resolution  Wide screen resolution  Increase font size  Decrease font size  Default font size  Skip to content Default color Pink color Green color Green color

Related Items

Home
This website has now moved to http://apps2fusion.com





OA Framework Controller ViewObject for Table Based Screen | Print |  E-mail
Written by Anil Passi   
Sunday, 25 February 2007
This article explains the programmatic steps required to complete a simple OA Framework Screen that interacts with the database table via screen. Prior to reading this article, you must read OA Framework Simple Screen where the underlying design of this screen has been explained. This particular screen interacts with Database via Java Entity Objects. Lets see the programmatic steps that are involved to implement the interaction between OA Framework Page and Database.

First step
As soon as the page loads, OA Framework will execute the processRequest Method against the controller of that page.
Here in this method, we wish to initialize the view object.
This step is just a copy paste from the "OA Framework Manual".
However, please note, this step is divided into two steps, because Controller must not directly interact with ViewObject.
a. From Controller [method processRequest], lets invoke a method that resides within ApplicationModule. 
import oracle.apps.fnd.framework.OAApplicationModule;
.
public class demoSimpleTableCO extends OAControllerImpl
.
public void processRequest(OAPageContext oapagecontext, OAWebBean oawebbean)

{
      super.processRequest(oapagecontext, oawebbean);
      //get the handle to AM Attached to our Simple Page Region MainRegionRN
      //The page is passed as parameter to this method, hence we can get handle
      //to the AM quite easily
      OAApplicationModule am = oapagecontext.getApplicationModule(oawebbean);
      am.invokeMethod("initializeSimpleVO4PageLoad");
}


b. Now, inside the AM Implementation, we need to handle the mehod call made from "Step a" above.
import oracle.jbo.Row;
import oracle.apps.fnd.framework.OAViewObject;
.
public class Demosimple01AMImpl extends OAApplicationModuleImpl
.
public void initializeSimpleVO4PageLoad()
  {
    //get a handle to the View Object that we wish to initialize
    OAViewObject vo = (OAViewObject)getXxOafDemoSimple01View1();
    if (!vo.isPreparedForExecution())
    {
      vo.executeQuery();
    }
   
//Create a blank Row
    Row row = vo.createRow();
   
//Attach that blank row to the VO. Data will be fed into this row, when the user types into the fields
    vo.insertRow(row);
    //Set the status of the blank row to initialized. This tells OA Framework that record is blank and must not be included in DML
    //Operations until    changes are made to its underlying VO [via screen fields]

   row.setNewRowState(Row.STATUS_INITIALIZED);
}




Second step
As soon as the button is clicked, OA Framework will execute a method named processRequest in the controller[ remember Controller is attached to page region.]
We need to perform a Commit from the controller when the button is clicked. But we are not supposed to call commit directly from the controller.
Hence we will invoke a method in AM, and within that method in AM "the COMMIT will actually take place".

a. From the processFormRequest in Controller, call a method that we will define in AM.
public class Demosimple01AMImpl extends OAApplicationModuleImpl
.
.

  public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    super.processFormRequest(pageContext, webBean);
    OAApplicationModule am = pageContext.getApplicationModule(webBean) ;
    am.invokeMethod("saveDataToSimpleTable") ;
  }

b. Now, inside the AM Implementation, we need to handle the call made from "Step a" above.
public class Demosimple01AMImpl extends OAApplicationModuleImpl
.
.
public void saveDataToSimpleTable()
{
        getDBTransaction().commit();
}



Now, after having completed all the steps, lets do the testing.
a. Rebuild the project.
b. Run the page


c. Enter some data into the screen.



d. Test to confirm that data is being inserted & updated in the table.



Comments (6)add
...
written by ajay , March 16, 2007
hai
good sites
Excellent Article
written by Mit , October 09, 2007
Really a good one article.
Well organized structure
Excellent
Thnaks man
parameter passing in call of AM method from the CO
written by Paramita Sanyal , February 19, 2008
Hi Anil!

I could successfully try your example of calling the method defined in the Application Module from the Controller. Thank you very much such wonderful article.

But could not pass any parameter to the method! Could you please tell me how can I pass a parameter from the controller to the method of the Application Module?

Kind Regards,
Paramita
parameter passing in call of AM method from the CO
written by Paramita Sanyal , February 20, 2008
Hi Anil!

I could successfully try your example of calling the method defined in the Application Module from the Controller. Thank you very much such wonderful article.

But could not pass any parameter to the method! Could you please tell me how can I pass a parameter from the controller to the method of the Application Module?

Kind Regards,
Paramita
...
written by Anil Passi , February 20, 2008
Hi Paramita

From controller, you will use invokeMethod, as shown below
oaapplicationmodule.invokeMethod("handleRemoveProcurementMapping"
, new String[] {paramString01, paramString02}smilies/wink.gif;


Within AM, you will do, as per your business logic....
public void handleRemoveProcurementMapping(String firstParam,String secondParam )
{
//do processing here
OADBTransaction oadbtransaction = getOADBTransaction();
oadbtransaction.commit();
}
}


Thanks,
Anil Passi
Hi Anil!!
written by Paramita Sanyal , February 20, 2008
It was very helpful. Thank you very much..

regards,
Paramita
You must be logged in to a comment. Please register if you do not have an account yet.

busy