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
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
Your blog rocks!! Just wanted to share something with ya… one blogger to another…
The re is this amazing site that I came across where u can make money by sharing information…c heck it out here’s the link www.myndnet dot com
The coolest part is…every time ur information gets sold u get paid for it!!
I signed it for it.. very cool stuff… u can also mail me at barot dot alpagmail.com
Cheers!
Al pa
Can you explain how to deploy a OA Framework page in Oracle Apps? Deployig covers AM,EO,VO also.
Regard s
Ashok G
Please see this article written by Anjani
http://www.google.com/search?q=site:apps2fusion.com+deployment-of-the-oa-framework-tutorials
This shows the deployment steps
Thanks
A nil Passi
I am trying to create Key Flexfields in OA Framework page. I saw your posting and hope you will be able to help me resolve this issue. I had tried the steps outlined in the Declarative Implementation as mentioned in OA Framework Developers Guide (Metalink note 269138.1). I am getting following error.
The data that defines the flexfield on this field may be inconsistent. Inform your system administrator that the function: KeyFlexfieldDef initionFactory. getStructureNum ber could not find the structure definition for the flexfield specified by Application = SQLGL, Code = GL# and Structure number =
I wonder why the structure number is null? How can I pass structure number to OAKeyFlexBean?
Thanks,
James
I want to know how do create scroll bar for a table style region. By default we get prev/next button with number of records specified in the property-pallet te. Is it possible to implement this using any other method. Please help me with this.
Keep up the good work of sharing the knowledge.
Tha nks,
Norman
i am new to oaf, can u plz tel me how to retriev data from table????/
RSS feed for comments to this post