Login
Register

Home

Trainings

Fusion Blog

EBS Blog

Authors

CONTACT US

OA Framework - All Articles
  • Register

Oracle Gold Partners, our very popular training packages, training schedule is listed here
Designed by Five Star Rated Oracle Press Authors & Oracle ACE's.

webinar new

Search Courses

In this tutorial, we will see how a new record can be added to a table using OA Framework screen.
We shall continue from where we left in the previous tutorial.
For simplicity
CO    Controller class. A java class attached to the page/region within a page.
PFR   processFormRequest [a method in controller class that is invoked when an action takes place in screen, just like good old triggers in D2K] 

PR     processRequest [a method in controller class that is invoked when a page loads in the browser]


Lets say the business requirement is
1. Add a button labelled "Create Person"
2. When this button is clicked, then processFormRequest(PFR) of the controller will be called in the main page [ie. xxPersonMainPG].
3. From the PFR of CO, call another screen named managePerson, by retaining the AM. managePersonPG screen will have one single record using which we will facilitate both updates and inserts to person table. (this is your design approach, I have chosen to use the same screen[managePersonPG] for both inserts and updates to person table).
This example is about inserts into the person table.
4. The navigation now moves to managePersonPG screen, and the Controller method processRequest() of managePersonPG screen will now be called.
(Note:- remember that processRequest is called as soon as the page is about to be rendered in browser)
5. In processRequest of managePersonPG screen, we will initialize a blank record, so that fresh inserts can be done.
6. On managePersonPG screen, a button named "Commit Data" will be available.
7. After entering data into the fields/record, user will click "Commit Data", hence invoking processFormRequest of the controller inmanagePersonPG.
From processFormRequest, we will invoke a method in AM, that will commit the transaction. Name of this method in CO is savePersonToDatabase()
8. After doing commit, we navigate back to the mainPage, i.e. back to xxPersonMainPG using pageContext.setForwardURL


Why do we need Step 5?
Answer:- Here we have fields in screen that map to columns within view object. When data is entered in these fields, these will then get transferred into view object record(in memory), when form is submitted. Hence for this purpose, we need to create a blank record in VO[view object], by callingvo.createRow, so that user can enter data into that row.


When a commit takes place; how does OA Framework know whether an insert or update must be done?
In this case we are setting the status of the record to STATUS_INITIALIZED. Once a commit takes place, Framework will then internally change the status of the row to update.



I want to default value into personid field from a database sequence. How do I do that?
One way of doing this is by defaulting a value at the time of blank record being created in VO. vo.createRow will call create() method in Entity Object. This is equivalent of when-create-record trigger in D2K.


What are the steps in tutorial?
1. Create a button on the main page, to "Add new Person". This button when clicked will raise an event named createPerson.
This event can then be trapped in PFR of the controller.
Click here for Video Link [creating this button and raising event]

2. In the mainPage's CO, inside PFR, handle the click of button "create new Person".
Call managePerson page, passing it parameter named xxParamActionOnPerson=createPerson
Click here for a demonstration of this step


3. Build a managePersonPG OA page using jDeveloper. This page will present user with a record to enter a new person.
Also add a button "Commit Data" to this page.
Click here for video link


4. Set a new controller for the new page xxManagePersonPG
In PR(processRequest) of the CO for xxManagePersonPG, call an AM method to initialize record(provided action is createRecord). Remember that processRequest is called when the page loads.In the corresponding AM method, initialize the record.
Click here for video link


6. Final step to handle a commit on managePersonPG, and to redirect the user back to the original main page[xxPersonMainPG ], after the new person has been created[after commit].
Test this (complete missing step to generate sequence)
Click here to see the last step of this tutorial


Anil Passi

Comments   

0 #1 Anjani 2007-07-12 06:52
Hi Anil,
Thank you very much for taking out sometime from your busy schedule and
providing us with this tutorial.
I can create person in JDeveloper but after I had deployed it in Apps environment,whe n I click on CreatePerson it shows the Search page instead of ManagePerson page.
I've moved all the class files in binary mode and others in Ascii mode
in apps environmentwith with same folder structure.
Plea se give some solution.
Quote
0 #2 Anil Passi 2007-07-12 07:10
Hi Anj

Did you import both the pages into MDS, i.e. main page and manage person page?

Thanks,
Anil
Quote
0 #3 kumar.ch 2007-07-12 10:07
hi Anil,

where do we write business logic in OAframework.

r egards
ram
Quote
0 #4 Anil Passi 2007-07-12 10:10
In BC4J, to begin with do all your validations in Entity Object
Quote
0 #5 Raneem 2007-09-13 06:44
hi Anil,
I have a problem, when i click the create button the fields is not displayed,
and an error occurs, please help.

oracle.a pps.fnd.framewo rk.OAException: No data found for region (/oracle/apps/a k/xxperson/webu i/xxPersonMainP G).


oracle.ad f.mds.MetadataD efException: Unable to find component with absolute reference = /oracle/apps/ak /xxperson/webui /xxPersonMainPG , XML Path = C:\software\AOJ DeveloperSoft\j devhome\jdev\my classes\JRADXML ;C:\software\AO JDeveloperSoft\ jdevhome\jdev\m yprojects;C:\so ftware\AOJDevel operSoft\jdevbi n\jdev\oamdsxml wk. Please verify that the reference is valid and the definition of the component exists either on the File System or in the MDS Repository.

or acle.adf.mds.Me tadataDefExcept ion: Unable to find component with absolute reference = /oracle/apps/ak /xxperson/webui /xxPersonMainPG , XML Path = C:\software\AOJ DeveloperSoft\j devhome\jdev\my classes\JRADXML ;C:\software\AO JDeveloperSoft\ jdevhome\jdev\m yprojects;C:\so ftware\AOJDevel operSoft\jdevbi n\jdev\oamdsxml wk. Please verify that the reference is valid and the definition of the component exists either on the File System or in the MDS Repository.
Quote
0 #6 Ravi Chandra Nuka 2007-09-20 05:42
How can I display default login info in jsp form and How to use radio buttons and check boxes. I have used 3 radio buttons in a radio group but by default it is saving the last radio button. How can I avoid this problem and How to locate the textfields at desired postions on a page like normal canvas design in forms 6i
Quote
0 #7 cpsiva 2007-09-30 06:18
Hi Anil,

Great Tutorial on OA Framework. I really liked it. I have a small problem in the CreatePersonMet hod in the PersonAM. The if condition is failing.

publi c void createPersonMet hod (String pAction, String pPersonId)
{
OAViewObjectImp l pervo =getPersonDetai lsVO1();
System.out.prin tln("========== ========in PersonAM CreatePersonMet hod");
if (! pervo.isPrepare dForExecution() )
{
System.out.prin tln("inside createPersonMet hod");
pervo.executeQu ery();
Row prow = pervo.createRow ();
pervo.insertRow (prow);
prow.setNewRowS tate(Row.STATUS _INITIALIZED);
}
else
{
System.out.prin tln("not in CreatePersonMet hod");
}
}

if I remove the "!" from the if condition it works fine. Please advise.

Apprec iate your help.
Thanks and regards.

Siva
Quote
0 #8 swapnilsrivastava 2007-11-12 13:01
hi anil,
I have developed a jsp for insertion and updation put when the controller redirects control to next page and i want to insert a new record or update it it shows no current row for view.
we earlier developed jsp following ur tips. But now i have more complexities to address:
Plz provide some clarifications regarding:
1.How do we write update/create method in the A.M for the changed scenario( because i followed exactly what u did but it's probably insufficient for present requirements.)
I have made a view which is the combination of 5 tables, i have defined the VO accordingly
so the search is working fine but there are lot of issues when i want to update/delete/a dd.
plz provide some clarity about how to define the methods in AM accordingly.
Do reply.
Quote
0 #9 srinivas sammeta 2007-11-13 04:45
hi
i have created three radio buttons, but by default three are enabled when i am running the page.

my requirement is when the form is running only one button is enable and also when i am select first radio button remaing are deselect.

so please send the code in adf technology and also which components are used i.e. selectBooleanRa dioButton, SelectOneRadio, ShowOneRadio.

thanks
Srinivas SL
Quote
0 #10 sumo 2008-01-30 16:19
oracle.apps.fnd .framework.OAEx ception: Could not load application module 'oracle.apps.fn d.frame.sehema. PersonAM'.
at oracle.apps.fnd .framework.webu i.OAJSPApplicat ionRegistry.reg isterApplicatio nModule(OAJSPAp plicationRegist ry.java:279)
at oracle.apps.fnd .framework.webu i.OAJSPApplicat ionRegistry.reg isterApplicatio nModule(OAJSPAp plicationRegist ry.java:78)
at oracle.apps.fnd .framework.webu i.OAPageBean.pr eparePage(OAPag eBean.java:1166 )
at oracle.apps.fnd .framework.webu i.OAPageBean.pr eparePage(OAPag eBean.java:497)
at oracle.apps.fnd .framework.webu i.OAPageBean.pr eparePage(OAPag eBean.java:418)
at _oa__html._OA._ jspService(_OA. java:88)
at oracle.jsp.runt ime.HttpJsp.ser vice(HttpJsp.ja va:119)
at oracle.jsp.app. JspApplication. dispatchRequest (JspApplication .java:417)
at oracle.jsp.JspS ervlet.doDispat ch(JspServlet.j ava:267)
at oracle.jsp.JspS ervlet.internal Service(JspServ let.java:186)
a t oracle.jsp.JspS ervlet.service( JspServlet.java :156)
at javax.servlet.h ttp.HttpServlet .service(HttpSe rvlet.java:588)
at oracle.jsp.prov ider.Jsp20Reque stDispatcher.fo rward(Jsp20Requ estDispatcher.j ava:162)
at oracle.jsp.runt ime.OraclePageC ontext.forward( OraclePageConte xt.java:187)
at _oa__html._RF._ jspService(_RF. java:102)
at oracle.jsp.runt ime.HttpJsp.ser vice(HttpJsp.ja va:119)
at oracle.jsp.app. JspApplication. dispatchRequest (JspApplication .java:417)
at oracle.jsp.JspS ervlet.doDispat ch(JspServlet.j ava:267)
at oracle.jsp.JspS ervlet.internal Service(JspServ let.java:186)
a t oracle.jsp.JspS ervlet.service( JspServlet.java :156)
at javax.servlet.h ttp.HttpServlet .service(HttpSe rvlet.java:588)
at org.apache.jser v.JServConnecti on.processReque st(JServConnect ion.java:456)
a t org.apache.jser v.JServConnecti on.run(JServCon nection.java:29 4)
at java.lang.Threa d.run(Thread.ja va:534)
Quote
0 #11 sumo 2008-01-30 16:30
oracle.apps.fnd .framework.OAEx ception: Could not load application module 'oracle.apps.fn d.frame.sehema. PersonAM'.
at oracle.apps.fnd .framework.webu i.OAJSPApplicat ionRegistry.reg isterApplicatio nModule(OAJSPAp plicationRegist ry.java:279)
at oracle.apps.fnd .framework.webu i.OAJSPApplicat ionRegistry.reg isterApplicatio nModule(OAJSPAp plicationRegist ry.java:78)
at oracle.apps.fnd .framework.webu i.OAPageBean.pr eparePage(OAPag eBean.java:1166 )
at oracle.apps.fnd .framework.webu i.OAPageBean.pr eparePage(OAPag eBean.java:497)
at oracle.apps.fnd .framework.webu i.OAPageBean.pr eparePage(OAPag eBean.java:418)
at _oa__html._OA._ jspService(_OA. java:88)
at oracle.jsp.runt ime.HttpJsp.ser vice(HttpJsp.ja va:119)
at oracle.jsp.app. JspApplication. dispatchRequest (JspApplication .java:417)
at oracle.jsp.JspS ervlet.doDispat ch(JspServlet.j ava:267)
at oracle.jsp.JspS ervlet.internal Service(JspServ let.java:186)
a t oracle.jsp.JspS ervlet.service( JspServlet.java :156)
at javax.servlet.h ttp.HttpServlet .service(HttpSe rvlet.java:588)
at oracle.jsp.prov ider.Jsp20Reque stDispatcher.fo rward
Quote
0 #12 Anil Passi 2008-01-30 16:36
Hi Sumo

the error says
oracle.app s.fnd.framework .OAException: Could not load application module 'oracle.apps.fn d.frame.sehema. PersonAM'

try this on server

ls -l $JAVA_TOP/oracl e/apps/fnd/fram e/sehema/Person AM*

Looks like you got some typos

Also, it helps to see the full error stack

Thanks,
Anil Passi
Quote
0 #13 Brajesh 2008-01-31 04:02
I want ot know that, i need to link a JSP page from Oarcle Apps form, which is desing with OA FrameWork, and the JSP page will dynamicaly generate a page as per my parameter given in form filed, g will it possible. If possible please tell me the procedure,or logic.
Thanks & regards
Brajesh
Quote
0 #14 sumo 2008-01-31 04:24
Thank u Anil
Now i am able to get the page
Quote
0 #15 brajesh 2008-01-31 04:35
I want to link a jsp page which will generate dynamically from a oracle Apps form, by clicking a button, and the form is design on OA Framework, and i want to put a diagrma on JSP page the digram will generated as per my given parameter in My OA form, and the diagram will show the hierachy of Job prograssion IN HRMS, i link it to HRMS database table. Please tell me the solution for that.
Thanks & regards
Brajesh
Quote
0 #16 sumo 2008-01-31 05:37
Hi Anil,

You have given solution to deploying a OA Framework page in server but Can we download a OA Framework page from the server ?
If yes , after downloding can we do some modification on that page?

Thank You.
Quote
0 #17 Anil Passi 2008-01-31 06:04
Hi Sumo

You can use jdr_utils for that purpose, i think the api name is printdocument

You can google on jdr_utils and find the info.

Having said so, why do you wish to download page from database.
Simpl y get that page from $PRODUCT_TOP/md s/../../

Thank s,
Anil
Quote
0 #18 sumo 2008-01-31 07:45
thakn You.
After downloading the page from the database i want do some modification on that as well as i want to add something on that.
Can i Do that?
is there any process for it?
Quote
0 #19 kal123 2008-02-05 05:32
Thank you Anil for providing such an excellent tutorial.

I'm having one problem...when I hit a "Create Person" button on main page...It's giving following error message.


Exce ption:
oracle.adf.mds .MetadataDefExc eption: Unable to find component with absolute reference = /oracle/apps/ak /xxperson/webui /managePersonPG , XML Path = C:\jdev_install _dir\jdevhome\j dev\myclasses\J RADXML;C:\jdev_ install_dir\jde vhome\jdev\mypr ojects;C:\jdev_ install_dir\jde vbin\jdev\oamds xml wk. Please verify that the reference is valid and the definition of the component exists either on the File System or in the MDS Repository.
at oracle.adf.mds. internal.Metada taManagerBase.f indElement(Meta dataManagerBase .java:1350)
at oracle.adf.mds. MElement.findEl ement(MElement. java:97)
at oracle.apps.fnd .framework.webu i.JRAD2AKMapper .getRootMElemen t(JRAD2AKMapper .java:501)
at oracle.apps.fnd .framework.webu i.OAWebBeanFact oryImpl.getWebB eanTypeDataFrom JRAD(OAWebBeanF actoryImpl.java :3718)
at oracle.apps.fnd .framework.webu i.OAWebBeanFact oryImpl.getRoot ApplicationModu leClass(OAWebBe anFactoryImpl.j ava:3451)
at oracle.apps.fnd .framework.webu i.OAPageBean.pr eparePage(OAPag eBean.java:999)
at oracle.apps.fnd .framework.webu i.OAPageBean.pr eparePage(OAPag eBean.java:502)
at oracle.apps.fnd .framework.webu i.OAPageBean.pr eparePage(OAPag eBean.java:423)
at _OA._jspService (OA.jsp:40)
at com.orionserver .http.OrionHttp JspPage.service (OrionHttpJspPa ge.java:56)
at oracle.jsp.runt imev2.JspPageTa ble.service(Jsp PageTable.java: 317)
at oracle.jsp.runt imev2.JspServle t.internalServi ce(JspServlet.j ava:465)
at oracle.jsp.runt imev2.JspServle t.service(JspSe rvlet.java:379)
at javax.servlet.h ttp.HttpServlet .service(HttpSe rvlet.java:853)
at com.evermind.se rver.http.Servl etRequestDispat cher.invoke(Ser vletRequestDisp atcher.java:727 )
at com.evermind.se rver.http.Servl etRequestDispat cher.forwardInt ernal(ServletRe questDispatcher .java:306)
at com.evermind.se rver.http.Servl etRequestDispat cher.forward(Se rvletRequestDis patcher.java:20 9)
at com.evermind.se rver.http.GetPa rametersRequest Dispatcher.forw ard(GetParamete rsRequestDispat cher.java:189)
at com.evermind.se rver.http.Everm indPageContext. forward(Evermin dPageContext.ja va:199)
at _OA._jspService (OA.jsp:45)
at com.orionserver .http.OrionHttp JspPage.service (OrionHttpJspPa ge.java:56)
at oracle.jsp.runt imev2.JspPageTa ble.service(Jsp PageTable.java: 317)
at oracle.jsp.runt imev2.JspServle t.internalServi ce(JspServlet.j ava:465)
at oracle.jsp.runt imev2.JspServle t.service(JspSe rvlet.java:379)
at javax.servlet.h ttp.HttpServlet .service(HttpSe rvlet.java:853)
at com.evermind.se rver.http.Servl etRequestDispat cher.invoke(Ser vletRequestDisp atcher.java:727 )
at com.evermind.se rver.http.Servl etRequestDispat cher.forwardInt ernal(ServletRe questDispatcher .java:306)
at com.evermind.se rver.http.HttpR equestHandler.p rocessRequest(H ttpRequestHandl er.java:767)
at com.evermind.se rver.http.HttpR equestHandler.r un(HttpRequestH andler.java:259 )
at com.evermind.se rver.http.HttpR equestHandler.r un(HttpRequestH andler.java:106 )
at EDU.oswego.cs.d l.util.concurre nt.PooledExecut or$Worker.run(P ooledExecutor.j ava:803)
at java.lang.Threa d.run(Thread.ja va:534)
Quote
0 #20 Anil Passi 2008-02-05 05:46
Hi Kal123

OAF can not find the XML file in location below

jdevHome Directorymyproj ectsoracleappsa kxxpersonwebuim anagePersonPG.x ml

Thanks,
Ani l Passi
Quote
0 #21 Kalyan 2008-02-05 14:24
Hi Anil,

I have managePersonPG. xml at the right location
jdevHomeDirectory/\myprojects\xxt\oracle\apps\ak\xxperson\webui\managePersonPG. xml

Still I'm getting the same error message. Could you pls help me out?

Thx
Kal123
Quote
0 #22 Kal123 2008-02-05 15:29
Hi Anil,

I have resolved this issue...It's working good...thx for your help.

Kal
Quote
0 #23 Kal123 2008-02-05 21:13
Hi Anil,

I am having one problem here. When I hit "create Person" button, It opens up "insert and Update Person" page with personId, Firstname, LastName, email, studentFlag,Nam eofUniversity filled with last record, I suppose all fields should be blank when latter page is opened up.
In addition to that there is one more issue I have, After I fill in fields with new record and hit "Commit Data", then Previous record is getting overwritten (Infact existing record being deleted) in underlying XX_PERSON_DETAI LS table.

Could you pls advise me on this where I went wrong ?

Thanks!!
Quote
0 #24 Anil Passi 2008-02-05 21:25
This will happen if your AM is retained, and hence the View Object cache is held within the memory. Hence the VO still remains executed for the previous record, which means VO pointer points old record. Surely, if you change data, the data of earlier record will be updated and commited.

For the CreatePerson, from processRequest, you need to initialize VO so that it points to a fresh new vanilla record in memory.

Thanks ,
Anil Passi
Quote
0 #25 Kal123 2008-02-07 17:27
Hi Anil,

I am getting following error while trying to run main Page.


The target xxPersonMainCO. java cannot be started as a servlet, because the class xxt.oracle.apps .ak.xxperson.we bui.xxPersonMai nCO does not extend javax.servlet.G enericServlet.
The target xxPersonMainCO. java cannot be started as an application, because the class xxt.oracle.apps .ak.xxperson.we bui.xxPersonMai nCO does not have a main method.

Please advise me on this issue.

Thanks!!!
Quote
0 #26 Kal123 2008-02-07 18:12
Hi Anil,

The following is the code that I've used from your tutorial. This code is in ProcessRequest Method of Controller Class for xxManagePersonP G

public void processRequest( OAPageContext pageContext, OAWebBean webBean)
{
super.processRe quest(pageConte xt, webBean);
String paramPersonActi on = pageContext.get Parameter("xxPa ramActionOnPers on");
String paramPersonId = pageContext.get Parameter("xxPa ramPersonId");
OAApplicationMo dule personam = pageContext.get ApplicationModu le(webBean);
Serializable personParamList [] = {paramPersonActi on,paramPersonId};

if (paramPersonActi on !=null && paramPersonActi on.equals("createPerson"))
{
personam.invoke Method("createP ersonMethod", personParamList );
}
}

The following is the code for CreatePersonMet hod in Application Module.

public void createPersonMet hod(String pAction, String pPersonId)
{
OAViewObjectImp l pervo = getXxPersonDeta ilsVO1();
if( !pervo.isPrepar edForExecution( ))
{
pervo.executeQu ery();
Row prow = pervo.createRow ();
pervo.insertRow (prow);
prow.setNewRowS tate(Row.STATUS _INITIALIZED);
}
}

You're sayin "For the CreatePerson, from processRequest, you need to initialize VO so that it points to a fresh new vanilla record in memory." I think, we're already initializing VO as per code given above

OAViewObjectImp l pervo = getXxPersonDeta ilsVO1();

Could you please help me where I'm missing here? Please tell me where exactly we need to initialize Vo sothat it points to New record in memory.

Thanks !!!
Quote
0 #27 Satish Mavuri 2008-03-31 15:28
what are the differences between these classes?

1) Entity Definition class

2)Entity Collection class

3) Entity Object class
Quote
0 #28 james 2008-09-03 11:41
anil
thanks for your knowledge. i am getting this error and wonder if you know why . the error is no current row for view when i try to save. any suggestions
tha nks
james
Quote
0 #29 Derrick 2011-11-04 04:56
hi Anil,

I'm new to OAF and your videos are very helpful.

I'm having a little bit of trouble, I can't find the control buttons of steps 1 and 2. There's no way to pause and play the video. Please help.
Thanks!!

Derri ck
Quote

Add comment


Security code
Refresh

Search Trainings

Fully verifiable testimonials

Apps2Fusion - Event List

<<  Apr 2024  >>
 Mon  Tue  Wed  Thu  Fri  Sat  Sun 
  1  2  3  4  5  6  7
  8  91011121314
15161718192021
22232425262728
2930     

Enquire For Training

Fusion Training Packages

Get Email Updates


Powered by Google FeedBurner