How to insert multiple rows in oaf
In this post , We will be discuss about how to insert multiple rows in oaf. We will try to create one data entry page in oaf which helps to insert multiple row in oaf. This post will share the detail steps to insert rows in oaf which will help to insert data in the tables from oaf page. Here below is the detail step to insert multiple rows in oaf.
Step by Step to insert multiple rows in oaf
1.First we will create table on which we insert Data.Create a new workspace name "RohitDataEntryOaf".
Right Click on "Applications".Click on "NewOAWorkspace".
Enter the name of Workspace="RohitDataEntryOaf".Click Ok.
Project wizard will open click next.
Enter the name of the Project="RohitDataEntryOaf".
Default Package= "rohit.oracle.apps.fnd.RohitDataEntryOaf"
Package determines the directory where the java class files and other files related to this project strored.
In this directory oracle.apps.fnd must be required."fnd" is the oracle application shortname you can use other applications like "ak" in this.
Enter the RunTime connection .Enter the E-business Suit Application User Name and Password.(already explained in the JDev installation).
Workspace and project has been created.
If we have to insert data we have to use EO.
TO create Entity Object(EO).
Right Click on the project "RohitDataEntryOaf".Click New
Enter the Entity Object name="SupplierEntryEO"
Defualt Package="rohit.oracle.apps.fnd.RohitDataEntryOaf.server"
Schema Object = XX_SUPPLIER_MASTER //Your Table Name.
we create "Entity Object" under the "Server" directory of the project as OAF Standard.
Click Next.
EO has been create as below.
Now we create a View Object(VO) which is based on Entity Object(EO).
Right Click on the project "RohitDataEntryOaf".Click New
Enter the View Object name="SupplierEntryVO"
Defualt Package="rohit.oracle.apps.fnd.RohitDataEntryOaf.server"
we create "View Object" under the "Server" directory of the project as OAF Standard.
Click Next.
Select the "SupplierEntryEO" in the left hand side and then shuttle this to the right and then click Next.
Click Next and then Finish.
View Object has created as below.
Now we create "Application Module".
Right Click on the project "RohitDataEntryOaf".Click New
Application Module wizard has open as below click next
Enter the Application Module name="RohitDataEntryAM"
Defualt Package="rohit.oracle.apps.fnd.RohitDataEntryOaf.server"
we create "Application module" under the "Server" directory of the project as OAF Standard.
Click next and then finish.
Select the "SupplierEntryVO" in the left hand side and then shuttle this to the right and then click next and then finish.
Application Module has created as Below.
Now we create OAF Page.
Right Click on the project "RohitDataEntryOaf".Click New
Enter the Page Name="RohitDataEntryPG"
Default Package="rohit.oracle.apps.fnd.RohitDataEntryOaf.webui"
we create the page under the webui under the project directory
Click Ok Page has been created.
Below in the Structure Page Click on "region1"
Repalce the ID of the "region1" with "PageLayoutRN" in the property inspector.
Click on the "PageLayoutRN".On the right hand side In the property inspector we will set the AM for the this page
AM Definition=rohit.oracle.apps.fnd.RohitDataEntryOaf.server.RohitDataEntryAM.
Right Click on the "PageLayoutRN" and then new and then click region.
Then region2 has created.
Replace the region2 ID with "MainRN" in the proeprty Inspector.
Change the Region Style=messageComponentLayout,
Right Click "MainRN".Click New and then Click messageTextInput.
Item1 has created.
Same as like this Create item2,item3,item4,item5,item5,item6.
Now set Values in the property inspector Window for item1.
ID=SupplierId
ViewInstance=SupplierEntryVO
ViewAttribute=SupplierId
Prompt=Supplier No.
Proeprty for item2.
ID=SupplierName
ViewInstance=SupplierEntryVO
ViewAttribute=SupplierName
Prompt=SupplierName
Proeprty for item3.
ID=SupplierAlias
ViewInstance=SupplierEntryVO
ViewAttribute=SupplierAliasName
Prompt=Supplier Alias Name
Proeprty for item4.
ID=SupplierCreationDate
ViewInstance=SupplierEntryVO
ViewAttribute=SupplierCreationDate
Prompt=Supplier Creation Date
Proeprty for item5.
ID=Adress1
ViewInstance=SupplierEntryVO
ViewAttribute=Address1
Prompt=Address1
Proeprty for item6.
ID=Adress2
ViewInstance=SupplierEntryVO
ViewAttribute=Address1
Prompt=Address2
Now we have to write the code for insert data so we need the Controller.
Creeate Controller.
Right Click on "PageLayoutRN".Click Set New Controller.
Enter The Controller Name=RohitDataEntryCO
Package=rohit.oracle.apps.fnd.RohitDataEntryOaf.lov
Put code in the Process Form Request Block as below
OAApplicationModule am=(OAApplicationModule)pageContext.getApplicationModule(WebBean).
am.invokeMethod("create_record");
Click on your Application Module "RohitDataEntryAM" then under Structure Window it shows the RohitDataEntryAMImpl.java
Create two methods under the RohitDataEntryAMImpl.java
1.
public void createrecord()
{
OAViewObject vo=(OAViewObject)getSupplierEntryVO();
if(!vo.isPreparedForExecution())
{
vo.executeQuery();
}
Row row=vo.createRow();
vo.insertRow(row);
row.setNewRowState(Row.STATUS_INITIALIZED);
}\\\
2.
public void saverecord()
{
getTransaction().commit();
}
Right Click on "PageLayoutRN".Click New.Click Region.
Region1 has created.
ID=PageButtons
Change the Region Style for region1 is "pageButtonBar".
Right Click on PageButtons Region.Click New.Click Item
item1 has created under "PageButtons" region.
Change the item1 Proeprty
ID=Save
Item Style=submitButton.
Write code under the Process Form Request Block under the contrller "RohitDataEntryCO"
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processFormRequest(pageContext, webBean);
OAApplicationModule oa=(OAApplicationModule)pageContext.getApplicationModule(webBean);
if(pageContext.getParameter("Save")!=null)
{
oa.invokeMethod("saverecord",null);
}
}
After this Right Click on the project "RohitDataEntryOaf" and then Click Rebuild.
Rebuild is the compilation of the project.
After successful compilation , Right Click on the page "RohitDataEntryPG".
Click Run.
Rebuild is the compilation of the project.
After successful compilation , Right Click on the page "RohitDataEntryPG".
Click Run.
How to insert multiple rows in oaf
0 comments:
Post a Comment