You are on page 1of 45

OAF : - Oracle Applications Framework Version : - 9.0.

3 NOTE: - For OAF install Jdeveloper (developed by Java & J2ee for E-Business Suite). Architecture of OAF: OAF follows the MVC (Model View Controller) Architecture. Model (BC4J Components) View (User Interface xml) Controller (Developed by Java Classes) What are BC4J Components? BC4J Components are as follows AM: Application Module VO: View Object EO: Entity Object VL: View Links

What is Onion Structure?

AM VO EO D B

The above structure is the Onion Structure; in which AM (Application Module) interact with the VO (View Object) and VO interacts with EO (Entity Object) and EO interacts with DB (Data Base). NOTE: • EO can only interact with the Data Base. • A page can have only one AM and AM can have number of VO and EO’s. • To display simple page no need of VO and EO, only AM is enough.

Steps to Install OAF? 1. Download the patch from Oracle metalink.

F:\Vijay_OAF.zip

2. Create one folder (Jdeveloper) in your local system. 3. Extract the above patch. 4. Create environment variable My computer  Properties  Advanced  Environment Variable  New Variable Name Variable Value : JDEV_USER_HOME : D:\Jdeveloper\jdevhome\jdev. copy the Jdevw icon and past it in desktop.

5. Go to D:\Jdeveloper\jdevbin\jdev\bin How to create simple page in OAF?

 Open Jdeveloper.  First create the data base connection Right click on Connections select the New Data Base Connection

Next  Give the Connection Name  Next

Give Oracle Application Data Base user name and password Username: apps Password: apps  Next

For the above screen first you need to get the .dbc file. By the following path we can get the .dbc file from the server /d01/applmgr/visappl/fnd/11.5.0/secure/erp_vis.dbc. Open the .dbc file copies the host name and past it in the host name in the screen, similarly get the Service Name and past it in the SID. - Next and click on Test Connection.

Next Finish.

Create Workspaces, to create workspaces follow the steps. Right click on Workspaces  select New OA Workspace

By default the Directory Name: D:\Jdeveloper\jdevhome\jdev\myprojects and give any file name : OAVijay.jws (Jdeveloper Workspace)  ok

Next  Give the default package name in the standard format as follows <Identifier>.oracle.apps.<application_short_name>.<component>.webui Ex: - Vijay.oracle.apps.po.WelcomePG.webui (web user interface)

Next checks the check box and select the use repository for design time And select the database connection name (Vijay).

Next, attach the DBC file name in the DBC file name by click on browse. Give the oracle application front end user name: operations Password: welcome

Click on Next Finish.

Create BC4J Components as follows. Right click on project and select New Business Components Packages

Change the .webui to .server, all the BC4J components will be stored in the server. Ex: - Vijay.oracle.apps.po.WelcomePG.server

Next Next Finish.

Create AM (Application Module), Right click on BC4J component select Application Module.

Give AM name with Suffix of AM Ex: - Welcome AM Next  Next  Next Next Finish.

Create a page, follow the steps Right click on project select NEW

Click on Web Tier

Click on Web Tier select OA Component and select the Page OK Give any name for page Ex: - WelcomePG and select the package as .webui NOTE: - Always keep the Page in .webui  ok

Click on the region1, go to property inspector  BC4J attach the AM Definition Ok

Give the Window Title: - Welcome PG and Title: - Welcome Page

Go to system Navigator  Right click on page <WelcomePG> Run WelcomePG.xml

FAQ’s • What is the Architecture of OAF? OAF follows the MVC (Model View Controller) Architecture. • What are the Components of OAF? System- navigator, Structure-Window, Complier log and Property-inspector. • Types of projects in OAF? Personalization, Extension and New page Development. • What is onion structure? AM VO EO  DB • Is Am required for new page? Yes • Steps to install OAF? a) Down load the patch from metalink. b) Extract this patch. c) Set the Environment Variable. • What is the default region when we create new region? Page layout region • Where will be the page, controller and region will store? .webui (Web user interface) • What are the BC4J components?

Components of BC4J are AM, VO, EO, VL and Associations. • Where will be the BC4J components will store? .server • is window title and title is mandatory? Yes • Which BC4J component will interact with the database? EO • To display simple note is VO and EO is required? No • What are the responsibilities to attach the user for OAF? OA frame work tool box Tutorial. OA frame work tool box Tutorial Lab. • How to find the path for .dbc file? visappl/fnd/11.5.0/secure/.dbc How to write code in controller? After developing the welcome page go to structure window right click on the region and select New Item.

Give the item ID name (ex: - Text) and Prompt (Enter our Name) in property inspector window

Similarly create another item with the item (Submit) item style as submit button and give the prompt in property window and run the page.

Go to structure window right click on region1 and select the Set New Controller.

Note: - The controller should be under the .webui Give any name to the controller with prefix with CO ex: - WelcomeCO

Click on Ok.

Here we can find two methods in controller 1) Process Request. 2) Process Form Request. What is Process Request and Process Form Request? Process Request: - This method is used to display any message while page is loading the you will write code in the Process Request. It has two parameters called pageContext and webBean. Process Form Data: - it works internally which is used to handle the internal validation against BC4J components. Process Form Request: - This method is used to display any message after taking any action on the page then you will write code in Process Form Request. It has two parameters called pageContext and webBean. Note: -To display any information we have to import the following interface import oracle.apps.fnd.framework.OAException; Write the following highlighted code in Processes from request.

Write this code in Processes Form Request

Then run the page ex: - WelcomePG Enter any text in the message input (ex:- OAF) and Click on Submit.

U can see the output on the next screen.

How to create Clear Button?

Create another button the same region and give the ID name as Clear with item style as Submit Button.

Clear

Clear

It looks like as follows when we run the WelcomePG.

Write the following code in Processes from Request for Clear Button.

NOTE: - To import any page follow the syntax

< Path of the page>/<page_name>. FAQ’s What is Controller? The controller responds to user action and directs to the application flow. What are the methods in controller? The following are the methods in controller a) Process Request. b) Processes Form Request. c) Processes Form Data. What is Processes Form Data? In this we are not writing a code it will work internally. What are the parameters in the Processes Request and Processes Form Request? pageContext and webBean. How to print a message in OAF? With which interface? Using the throw new under the OAException Interface. Which method is used to move to another page? pageContext.setRedirectURL(“page_path and page_name”); How to create Search Page? Create OAWorkspace b right click on the Workspaces New OAWorkspace

Give the file name Fine Name : - <an name> ex:- Vijay  ok

Next

Give the fine name: <any name> ex: - Vijay Default package: - ex: -Vijay.oracle.apps.po.search.webui next Give the connection to the data base

Next Attach the .dbc file and give the front end username and password.

Next  finish. Create BC4J component

Next  change the path from .webui to .server  next

Next  next  finish. Create Application Module

Give the application module name Ex: - searchAM  next  next finish.

Create EO by right click on the BC4J component select the New Entity Object (EO)

Give the EO name: <any name> Ex: - searchEO And check the checkbox called synonyms and select the any schema object ex; PO_HEADERS_ALL

Next next by default it takes rowed will be the primary key (click on Yes)  Select all general methods  next.

Here by default system will ask to create the VO and give the VO name ex: - searchVO

Next  finish. Now you can see that AM, VO, EO is created, then click on AM select Data Model and attach the VO to AM

Click on apply and ok. Click on VO select query write the condition in the where clause

Write the where clause

Ex;- searchEO.TYPE_LOOKUP_CODE=UPPER(NVL(:0,TYPE_LOOKUP_CODE))

Test the query by clicking on the test button. Create new page by right clicking on the project name select New.

Select Webtier  OAComponents  Page  Ok

Give the page name (any name) ex; - searchPG and select the .webui  ok

Automatically in the structure window one region will be created (region1). Click on that region attach the AM Definition

Select the AM  ok, and give the window title (any name) ex: - SearchPG, title (an name) Welcome to search page. Create another region and select the region style as Message Component Layout.

Create one message Text input

Give the ID; name for the item and give any prompt name (Ex: - Enter Type Lookup Code) Rebuilt the page and run the page to test. You can see the following out put.

Create another region with region style as PageButtonBar and create an item by giving the item style as SubmitButton and give any ID name (Ex: - Search) and give any prompt as well (Search). Rebuilt the page and test the page.

Create another region with the region style as advancetable and attach the view instance (searchVo1) as shown in figure.  Ok.

Right click on that region and select the New  Column.

And right click on column1 create one item.

Give the item style as MessageStyledText and select the view attribute (PoHeaderId).

Click on column header  New  SortableHeader and give the prompt (PO Header ID)

Similarly create any number columns………. Hear I am taking the Agent ID, Type Lookup Code, Vendor ID ….etc NOTE: 1. For column adjustment click on the advanced table region and change the width as 100%. 2. To suppress any column change rendered to false (in visual of property window) 3. For space create one region with the item and region style as spacer and give height. Rebuilt the page and run the page you can see the following out put. Then write the code in VO, click on searchVO  select serachVOImpl.java And write the following code in searchVOImpl. Right click on the code and select MakeSearchVOImpl.Java

You can see the status here

Click on AM  select searchAMImpl.java and write the following code. First we need to import the searchVOImpl. import Vijay.oracle.apps.po.search.server.searchVOImpl; Create controller, give the controller name (any name) and write the following code in controller. First import the following packages import oracle.apps.fnd.framework.OAApplicationModule; import Vijay.oracle.apps.po.search.server.searchAMImpl; import java.io.Serializable; Write the following code in PossessFormRequest a) Initialize the Application Module.

Write the following code in controller

Rebuilt the page and test the work and you will see the out put as follows

Enter any type of purchase order like Standard, Rfq, Blanket and Contract. How to call from one page to the other page? In the begin you already created search page with the PO_HEADERS_ALL table with respect to that we will take PO_LINES_ALL with respect to the PO_HEADER_ID we have to display PO_LINES. Now we will create another search page for lines. Create BC4J component for polines as shown in fig.

Create AM, VO and EO for PO_LINES_ALL. Attach the VO to AM. Create new page foe lines. Create the regions, columns and buttons same as search page. The final output for lines page looks like shown in fig.

Click on VO  select the Query and Click on VO and write the following code in polinesVOImpl.java

Click on AM and write the following code in polinesAMImpl.java

write the following code in polinesAMImpl.java Create controller (insertCO) and write the following code. Import all the following interfaces. .message.OAMessageStyledTextBean; import Vijay.oracle.apps.po.polines.server.polinesAMImpl; ProcessessRequest: -

ProcessesFormReuest: - this is for back button.

Next we need to give the link between headers and lines, to create the link follow the steps.

You can see the final out put as shown in fig.

Enter the required details in the above screen and click on search and click on particular header id we can get the details with respect to header id. As shown next fig. How to insert data into custom table? 1) Create a table as follows in cus_top.

create table vijay_suppliers ( supplier_id number, title varchar2(10), first_name varchar2(30), last_name varchar2(30), middle_name varchar2(30), supplier_category varchar2(30), supplier_number varchar2(30), last_updated_by number, last_update_date date, last_update_login number )
1. Grant all on vijay_suppliers to apps; 2. Connect to apps and create synonym as follows

Create synonym vijay_suppliers to cus.vijay_suppliers; Create sequence in custom top and grant it all to apps and create synonym in apps 1. Create one insert page using this table. 2. The out put will be as shown in fig. Write the following code in supplierInsertAMImpl.java The above program is for both insert with sequence. For constant or default value add the below code in the above program. vo1.getCurrentRow().setAttribute("SupplierId",”OracleCorp”); write the following code in supplierInsertCO import oracle.apps.fnd.framework.OAApplicationModule; import oracle.apps.fnd.framework.server.OADBTransaction; import Vijay.oracle.apps.po.suppliersInsert.server.supplierInsertAMImpl; processesrequest: ProcessesFormRequest: Rebuilt the page and run the page, you can see as shown in fig.

Enter the data and click on save. Now you see the data in back end in the respective table vijay_suppliers.