DML operation in oaf
In this post, we will discuss , how we can perform DML operations in oaf. How we can create Record Insert , delete and update OAF page. We can perform all the operations In oaf but we need to perform some steps to do that. We need to handle these operations in our Controller and Application module java classes. Here below I will share the Detail steps for DML operation in oaf.
In this DML operation in oaf , I will be share Three different Examples:-
1. Insert Page in OAF.
2.Delete in OAF
3.Update in OAF.
Insert DML operation in oaf
Step1 :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.
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
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.
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
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.
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
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.
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.
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.
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,
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.
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
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.
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.
Delete in OAF
You can refer this post to get the detailed steps for How to do Delete operation in OAF
0 comments:
Post a Comment