Wednesday, September 24, 2014

How to create view object(VO) in OAF



How to create view object in OAF

Now we are going to learn how to create the view object.
We will create the view object in hello ward page.

Steps to create the view object

Step1:- Right click on project select new

           


Step2:- Select ADF Business Component and the view object and click ok.

           
Step3:- Welcome window appears click on next.
             Specify the below details.
            Package:- sangu.oracle.apps.ont.HelloWord.server
            Name :- EmployeeVO

Note:- the view object should be in .server directory and view object name ends with VO for  
best practice.


 Click on next , next.
Step4:- In step 5 of View Object creation write the sql query for view object and click next.

           
Step5:- In step 8 check the Generate Java File check box and click finish.

           
This completes the creation of View Object.



 Now we have to attach this view object to Application Module.

Step6:- Double click on AM and select the vo from left side and move that to right side and
 click on apply and ok.

           
Now the view object is successfully attached to AM. Now we can use this vo anywhere in the project.



           

Wednesday, September 17, 2014

How to Create ViewObject(VO) Dynamically in OAF




Create ViewObject(VO) Dynamically


Now we are going to learn about how to create the view object (VO) programmatically.

Write the following code in In ProcessRequest

import oracle.apps.fnd.framework.server.OAViewDef
import oracle.apps.fnd.framework.OAViewObject 


    SampleAMImpl am=(SampleAMImpll)pageContext.getApplicationModule(webBean);
    if(am!=null)
    {
        OAViewDef viewdef=(OAViewDef)am.getOADBTransaction().createViewDef();
        viewdef.setSql("select ename from scott.emp");
        OAViewObject vo=(OAViewObject)am.createViewObject("SampleVO1",viewdef);
       
         //SampleVO1 is ViewObject Name
            
    }