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
good sites
Well organized structure
Excel lent
Thnaks man
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,
Parami ta
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,
Parami ta
From controller, you will use invokeMethod, as shown below
oaapplica tionmodule.invo keMethod("handl eRemoveProcurem entMapping"
, new String[] {paramStri ng01, paramString02 125;);
Within AM, you will do, as per your business logic....
public void handleRemovePro curementMapping (String firstParam,Stri ng secondParam )
{
//do processing here
OADBTransaction oadbtransaction = getOADBTransact ion();
oadbtransaction .commit();
}
}
Thanks ,
Anil Passi
regards ,
Paramita
Excellen t site, I have a query. I have Advanced Table based screen and the underlying data for the Advanced table comes from multiple Tables or EO's. Can you please guide me on how i can handle inserts and updates for advanced tables which are based on more than one EOs. One way I can handle inserts/updates in multiple tables is using OAPlsqlEntity Objects. But is there a way I can do this using simple EO/VO.
Thanks,
Mahesh
Based on certain condition I do not want to display one of the column from my advanced table. Please could you let me know how to do that.
Thanks
V is
Thanks,
Anil Passi
need your help.
consider the same page which is displayed in this article (OA Framework Controller ViewObject for Table Based Screen)
my requirement is
if user select one (i have singleselect) row from the list of rows displayed and click on the button "Save data to table", i want to fetch person_id from VO and do certain validation.
wha t i am trying is, extending the controller and in the processFormRequ est trying to get the handle for the button, and if handle tells me that button is clicked, calling a method in AM to find which row in VO is selected.
i am facing following problems which i am seeking help from you :)
1. button on the page is not submit button, its simple button, i checked for event but it is null. how to get handle for this button. button is on OATableBean
2. in AM, how to find out the currently selected row, i tried with getCurrentRow but it is throwing Null pointer error.
Please can you help me on this.
i am passing some values from one page to another. In processRequest of the next page I can see the values.
Now I want to display them in a table once the page loads.. Can you please tell me how do i do that??
Thanks in advance,
Regards,
Abhik.
[iam.abhik7gmail.com]
can u help me to do this?
RSS feed for comments to this post