Apps To Fusion

.......Our Journey from Apps To Fusion

 
  • Increase font size
  • Default font size
  • Decrease font size



OA Framework Controller ViewObject for Table Based Screen

E-mail
User Rating: / 1
PoorBest 
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 (10)add
...
written by ajay , March 16, 2007
hai
good sites
report abuse
vote down
vote up
Votes: +0
Excellent Article
written by Mit , October 09, 2007
Really a good one article.
Well organized structure
Excellent
Thnaks man
report abuse
vote down
vote up
Votes: +0
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
report abuse
vote down
vote up
Votes: +1
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
report abuse
vote down
vote up
Votes: +0
...
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
report abuse
vote down
vote up
Votes: +1
Hi Anil!!
written by Paramita Sanyal , February 20, 2008
It was very helpful. Thank you very much..

regards,
Paramita
report abuse
vote down
vote up
Votes: +0
Table Based Screen based on Multiple Table.
written by Mahesh , July 08, 2008
Hi Anil,

Excellent 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
report abuse
vote down
vote up
Votes: +0
Advanced Table - hiding columns
written by Vis , September 29, 2008
Hi Anil,

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
Vis
report abuse
vote down
vote up
Votes: +0
...
written by Anil- , September 29, 2008
Please raise on forum http://apps2fusion.com/forums

Thanks,
Anil Passi
report abuse
vote down
vote up
Votes: -1
handle for simple button and current row in VO
written by Pradeep Dahake , December 13, 2011
Dear Anil

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.
what i am trying is, extending the controller and in the processFormRequest 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 smilies/smiley.gif

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.




report abuse
vote down
vote up
Votes: +0
Write comment
quote
bold
italicize
underline
strike
url
image
quote
quote
smile
wink
laugh
grin
angry
sad
shocked
cool
tongue
kiss
cry
smaller | bigger

security image
Write the displayed characters


busy
Last Updated ( Sunday, 23 March 2008 14:30 )  

Related Items

Search apps2fusion