You are on page 1of 218

1.

Introduction

What is OAF?

OAF is a framework developed by oracle corporation for application development within


the oracle EBS(e-Business Suite).

Oracle Application Framework (OAF) provides visual and declarative approaches to Java
EE development.

The OA framework is also available to customers for personalization’s, customizations and


custom-application development.

Components of OAF

 BC4J(Business Component for Java):-

Java business components for representing business logic.

 UIX(User Interface Xml):-

Java components for representing UI.

 OA Extension:–

Design time tool to define declarative data in JDeveloper.


Data resides in Metadata Repository (MDS) or XMLfiles in
the file system.

 OC4J(Oracle Component for Java):–

The Java Virtual Machine, for running from JDeveloper.

 AOL/J:-

Applications authentication, authorization and Java services

 OA Framework:-
Programmatic ‘glue’ which integrates these technologies.

Characterstics of OAF
 Declarative and Rapid application development
 Consistent and Compelling UI
 Built-in durable Personalization
 Extensible UI and business logic
 J2EE based, Java and XML
 Based on MVC architecture.

Difference between OAF and Oracle Forms

The major difference between the Oracle Application Framework and Oracle Forms are:-
OAF FORMS

OAF follows MVC and Client Server Forms Follows only Client Server
Architecture. Architecture.

OAF pages are light weight components Compare to OAF pages Forms are not light
weight.

OAF Pages can access through mobile Forms Can’t.


devices.

Look and Feel is good. Not better when comparing to OAF.

OAF pages are integrated with the Java Top. Forms are integrated with Application Top

A page is divided into regions. Regions A form is divided into blocks; blocks
contain fields, buttons, tables, and other contain the fields, buttons, and other
components. components.
2. Structure of OAF

Structure of OAF

The OAF pages follow MVC architecture.

The structure of OAF contains:-

 MODEL
 VIEW
 CONTROLLER

MODEL:-
The entire database related transactions in OAF pages will be taken care by the MODEL. Model is
where the application implements business logic.

 The major components of Model are:-


 Application Module(AM).
 Entity Object(EO).
 View Object(VO).

Application Module:-

Application module serves as a container for related BC4J objects.

Application module provides transaction context.

Application module establish database connection.

Entity Object:-

Entity object encapsulates business rules and logic.

Entity objects are mainly used by any program that inserts, updates or deletes data.

Entity object provides consistent data validation across all application.

Entity objects may be linked to other entity objects by entity association objects.

View Object:-

View object encapsulates a database query.

View object provide iteration over the query result set.

View object primarily based on Entity Objects (EO) or may be based on plain SQL or may be based on
multiple Eos.

View object provides single point of contact for getting and setting Eos values.

VIEW:-
View is nothing but the OAF page output.

Each UI (User Interface) widget corresponds to one or more java objects (Beans).

The java objects are used create HTML at run time.

Customers and third parties use Page Personalization to modify pages to fit business needs and user
preferences.

CONTROLLER:-

Controller controls the UI behavior.

Controller classes define how your java beans behave.

Controller classes subclass OAControllerImpl.

OAPageBean is the main OA Framework page processing class.

There are methods in the Controller class to handle GET and POST requests.

 processRequest.
 processFormData.
 processFormRequest.

The OAPageBean calls the processRequest method when a browser issues a GET request.

The OAPageBean then calls processFormData for pages that insert or update data.

The OAPageBean calls the processFormRequest method when a browser issues a GET request.
3. Onion Structure of OAF

Onion Structure of OAF

Onion Structure is the another structure of OAF.

Each layer only “knows” about the layers below it.

This encapsulation promotes easier reuse of components.

The components of Onion Structure are:-

 Database.
  Entity Object.
 View Object.
  Application Module.
 OAController.

Database:-

It is a logical collection of data objects such as Tables, Views,

Sequence etc.

Entity Object:-

Encapsulates the business rule and logic.

Map to database objects or other data source.

View Object:-

Manage collection of data.

Represents a query result.

Application Module:-

Application Module defines logical data module and business methods needed to support an
application.

Application Module handles the Transactions.

OAController:-

Controller will take care of the web browser activities.

Controller responds to the user actions and directs application flow.


4. MVC Architecture of OAF

MVC Architecture

The components of MVC Architecture are:-

 MODEL.
 VIEW.
 CONTROLLER.

MODEL:-
Model contains the components which handles data directly from database.

The model encapsulates underlying data and business logic of the application.

Model components are implemented using Business Components for Java

There are three basic component classes:-

 The Application Module:– A container for related BC4J objects.

 Entity objects:– Encapsulate business rules.

 View objects:– Present data to the Framework page.

Model additionally contains three other components:-

Callable Statement:-

Callable Statement is used to call a PL/SQL statements.

Prepare Statement:-

Prepare Statements are used if we are using a “SELECT” statements.

OADB Transaction:-

OADB Transaction will take care of Oracle Apps related Databse Transactions.

Entity Object (EO):-


Entity Object contains custom business logic.

Entity Object map to a database table or other data source.

Entity Objects can be created on database objects like Table, View, Synonym etc or other Entity
Objects.

Each entity object instance represents a single row and Contains attributes representing database
columns.

Entity Objects are mainly used for insert, update or delete the records from database.

Entity Object will take care of business logic and validation related to a table.

Entity Object Encapsulate the attribute level and entity level validation.

OA Framework supports both Java and PL/SQL entity objects

If we want to perform the DML operations on the standard (Seeded) table then we go for PL/SQL
based Entity Object.

If we want to perform the DML operations on the custom table then we go for Java Based Entity
Object

All the entity objects that you create are subclass of oracle.apps.fnd.framework.server.OAEntityImpl

class.

While Creating the Entity Object always generate accessors (setters/getters).

EO should have following attributes(WHO COLUMNS):-

 CreationDate
 CreatedBy
 LastUpdateDate
 LastUpdatedBy
 LastUpdateLogin

After creating the entity object always attach that to VO.

Entity Association:-

Define a relationship between entity objects.

Facilitate access to data in related entity objects, May be based on database constraints, May be
independent of database constraints

Consist of a source (master) and a destination (detail) entity.

There are two types of Entity Associations:-

 Reference Association.

 Composition Association.

Reference Association:-

Used for weak association between entities such as foreign keys for lookups.

Ex:- Requisition - Supplier association.

Composition Association:-

Used for composite objects with strong "owning" relationship

Use if: child entity cannot exist without parent;

Child is deleted when parent is deleted

Example: RequisitionHeader – RequisitionLine association


Behavior of Composition Association:-

 When child is dirtied, parent is dirtied automatically

 When child is locked, parent is locked first automatically

 Parent is brought into memory automatically if not already in memory

 Validation order is child first, parent second.

 parent has final veto power on child modifications

 Insert/Update order is parent first, child second

 Delete order is child first, parent second

View Object (VO):-

View Object is mainly used for Manage collection of data and to display them in OAF page.

View Object represents a query result.

View Objects are used for joining, filtering, projecting and sorting your business data.

View Object can be created in three ways:-

 Generated SQL based on Eos.

 Expert Mode custom SQL with no underlying Eos.

 Expert Mode custom SQL manually mapped to Eos.

View Object can be created on the bases of Single Entity Object or more than one Entity Object.

View Object can also be created from SQL statements.


A VO controls many view rows.

Each view row represents a row of the data that is queried from the database.

When you want aliases in the query, make sure that the attribute settings in the VO wizard include
the alias names.

All the view objects that you create are subclass of

oracle.apps.fnd.framework.server.OAViewObjectImpl class.

While creating always create View Row Java class

(ViewRowImpl) and accessors (setters/getters).

Each VO should have:

 <YourName>VO.xml
 <YourName>VOImpl.java (optional)
 <YourName>ViewRowImpl.java (required)

After creating the view object always attach that to AM.

View Link:-

A view link is a link between view objects.

You can create view links by providing the following:

 Source and destination views


 Source and destination attributes

Use a view link to create a master-detail relationship between view objects.


 Allows dynamic synchronization between parent and child VO.

 Child rowset is ‘refreshed’ when the current parent row changes.

Application Module (AM):-

Application module serves as a container for related BC4J objects.

AM defines the logical data model and business methods needed support an application task.

AM is the interface between the Client transactions and Data Base transactions.

Types of AM:-

 Root AM (The AM attached to main region is called Root AM).

 Nested AM(The AM attached to child region is called Nested AM).

All the pages are attached to the AM.

The entire application module that you create is subclass of

oracle.apps.fnd.framework.server.OAApplicationModuleImpl class.

Transaction:-

Holds database connection.

Holds all entities centrally separated from AMs and VOs.


Holds list of EOs that requires:

 Validation
 Posting to database
 Commit notification

BC4J Packages in JDeveloper:-

BC4J packages also correspond to directory paths.

EO-related (business logic) .java and .xml files in

oracle.apps.<application shortname>.<module>.schema.server

 AM and VO (UI-related logic) .java and .xml files in


oracle.apps.<application shortname>.<module>.server

Poplist- and LOV-related VO and AM .java and .xmlfiles in


oracle.apps.<application shortname>.<module>.poplist.server

and

oracle.apps.<application shortname>.<module>.lov.server

View:-

View is the actual output of OAF pages.

View is implemented using UIX technology, after running the page in JDeveloper,

then automatically UIX will generate web.xml file.

Then generated web.xml file will be converted into HTML format of OAF page.
Customers and third parties use Page Personalization to modify pages to fit business needs
and

user preferences.

What ever the result we want in our page that we can set here.

Oracle has provided lot of properties for everything that we want to modify the visual

representation of the data.

Controller:-

Controller will take care of the web browser activities.

Controller classes define how your java beans behave.

Controller responds to user actions and directs the application flow.

Most of the codes will write in controller.

There are several tasks you will do routinely in your code.

 Handle button press and other events

 Automatic queries

 Dynamic WHERE clauses

 Commits

 JSP Forwards

The most common locations for your code in Controller will be:-

 processRequest (code for page initialization such as

 HTTP GET actions, after passivation, and so on)


 processFormData (typically no code)

 processFormRequest (code for HTTP POST actions)

The common parameter passings to controller are:-

 OAPageContext:- (Using the page Context we can set and get the item
values)

 OAWebBean:- (Using OAWebBeean we can get the position of the


field in the page).

The entire controller that you create is subclass of


oracle.apps.fnd.framework.server.OAControllerImpl class.
5. CSS Styles in OAF

Common CSS Styles in OAF


CSS (cascading style sheet) are used to change the look and feel.

Apply CSS styles to regions and items to provide a consistent look and feel.

Customers can change styles easily

The most common CSS Styles are:-

OraDataText:–

Bold, left-aligned display-only field data.

OraFieldText:–

Plain text in updatable fields, checkboxes, etc.

OraPromptText:–

Right-aligned prompts.

OraLinkText:–

Left-aligned plain text data that should render as a link in the link color.

OraInstructionText:–

Any of the left-aligned plain text instructions that you add to your page.

OraErrorText:-

Display the data in Red color.

Invoking the CSS

Steps to invoke the CSS:-

Select the item or region where u want change the style.

In property inspect
Visual--->
CSS Class:-(OraDataText)<Give the css which u want>

After setting this css the data added in the field should display in bold.

The desired output will be as follows.


Creating Custom CSS

The user can create his own CSS Styles.

Create CSS in the Custom.xss

You can find Custom.xss in jdevhome\jdev\myhtml\OA_HTML\cabo\styles

The custom.xss looks like as follows

<?xml version="1.0"?>

<!-- $Header: custom.xss 120.39 2005/08/08 09:27:38 atgops1 noship $ -->


<styleSheetDocument xmlns="http://bali.us.oracle.com/cabo/ocelot">

<import href="oa.xss"/>

<styleSheet>

<!-- Please start your customizations here -->

<style selector=".Red">
<includeStyle name="DefaultFontFamily"/>
<property name="font-size">11pt</property>
<property name="font-weight">Bolder</property>
<property name="color">#008000</property>
<property name="text-indent">3px</property>
</style>

<!-- Please end your customizations here -->

</styleSheet>

</styleSheetDocument>
6. Naming Convention in OAF

General Naming Convention in OAF

File Name length:-

File names are limited to 30.3 characters for OA Extension XML files (50.java for Java
files).

Object Name length (regions, items, and so on):–

For performance reasons, object names (internal ID’s) are limited to 30 characters.

Common abbreviations are acceptable to keep names as short as possible.

Acceptable abbreviations can be instantly understood by a third party consultant.

Object names in pages must be unique in the entire page.

Most names follow Java naming convention (mixed case).

Naming Standards for a Page:- The page name should convey the object it Presents.

Page name ends with PG:- <object name>PG

For ex:- EmpSearchPG,


EmployeePG,
SupplierPG

Naming Standards for a Region:- The region name should convey the object it Presents.

Region name ends with RN:- <object name>RN

For ex:- MainRN,


EmpSearchRN,
PoHeaderRN

Naming Standards for an Object:-

EmpName
SearchEmpName
ResultsEmpName
Naming Standards for an Entity Object:- The EO should be named for the objects stored
in its
underlying entity.

Entity Object name ends with EO:- <EntityName>EO

For ex:- EmployeeEO,


SupplierEO,
PurchaseOrderHeaderEO.

Naming Standards for an Entity Association Object:-The AO name should convey the
relationship
between a parent and its child entities.

Entity Association name ends with AO:-<parent>TO<child>AO

For ex:- PoHeaderToLinesAO,


SupplierToSitesAO,
DepartmentToEmployeeAO

Naming Standards for a View Object:-The VO name should convey the nature of
the query.

View Object name ends with VO:- <Descriptive Name>VO

For ex:- EmployeeVO,


SupplierVO,
PurchaseOrderVO.

Naming Standards for a View Link:- The VL name should convey the relationship
between the master and detail VOs.

View Link name ends with VL:- <Master>To<Detail>VL

For ex:- EmployeeToDepartmenstVL


PoHeaderToLinesVL

Naming Standards for an Application Module:- The AM name should convey the purpose
of the UI
module it services.

Application Module name ends with AM:- <ModuleName>AM

For ex:-HelloWorldAM,
EmployeesAM,
SupplierAM.
7. Installation Steps Of JDeveloper

Installation Process Of JDeveloper

Step1:- First wou need to download the JDeveloper patch of the version.
All the patches we can download from Oracle Meta link, and the file size is
500+ MB.

Step2:- Extract the ZIP file and open the patch folder you will find three folders.
>jdevbin.
>jdevdoc.
>jdevhome.

Step3:-Go to

Jdevbinjdevbin
Their u find jdev and jdevW icons.
The jdev is for UNIX environment and jdevW is for Windows environment.
Create the shortcut of jdevW. And send to desktop
Step4:-Next we have to create the JDev environmental variable for windows.

>Right Click on My Computer select properties.


Properties--> Advanced System Settings--> Environment veriable
next click on New Button for adding a New User variable as show in the
below figure.

>Next select Advanced System Settings.

>Next Select Environment Veriables.


>Click on new to create new environment veriable.

>Give the Variable name--> JDEV_USER_HOME


Variable Value --> path of the jdevhome\jdev
Step5:-After creating the environment veriable we have to move the DBC file
from Oracle Apps fnd top to jDeveloper patch.

Here we are using WinScp which connects to the server from our desktop system.
After finding where exactly the DBC file located go to that particular path and copy the DBC
file.
(/oracle/apps/r12/inst/apps/visr12_ebsr12/appl/fnd/12.0.0/secure)

After copying, in your desktop system go to


Jdevhome--> jdev--> dbc_files--> secure
Here we will not find any files or documents the folder is empty now we need to paste the
DBC file which we copied from the Oracle Apps Instance Server.

Move thefile from server to local machine

Step6:-After moving the DBC file now open the JDeveloper and create the
Data Base Connection.

After opening the file it will ask for Configure File Type Associations, on check box check
all the available types to associate with JDeveloper.

Go to Connections tab after that Right Click on Data Base folder and then select New
Database Connection…,

After selecting the New Database Connection,the welcome window will open just click on
next.
After that in nex window give the connection name. Make sure that Connection type should
be Oracle(JDBC), click next.
In the Authentication tab specify the username and password,
give Oracle SQL Developer tool connection name.

Next in connection tab give the connection details


Host Name:-ebsr12.com
JDBC Port :1521
SID :visr12
Click next

Next in test tab click on test connection and check for the connection is it success or not.
Step7:-After creating the DataBase Connections,
Set the default project properties.
Go to Tools à Default Project Properties

In that select Runtime connection, adjust the runtime connection information, necessary for
the database and Oracle E-Business Suite.

Brows the DBC file from the jDeveloper patch where we moved from the server. (Jdevhome-
-> jdev--> dbc_files--> secure)

Username:- The user name is Oracle Apps instance User Name(sspatil)


Password:- Password is Oracle Apps instance Password.

Application Short Name:- In which application u want to run give the


Application Short Name of that application.
Responsibility key:- Responsibility key of that application short name.
This finishes the configuration of JDeveloper.
8. Sample OAF Page Creation.

Sample OAF Page Creation

Step1:-
Create a New OA Workspace and OA Project.

Right click on the Application and select New OA Workspace.

Be careful to create OA workspaces and OA projects, rather than plain workspaces or


projects.

 Only OA projects allow you to create pages, regions, and attribute sets.
 Only OA projects capture Oracle Applications related information.

Give the File Name for the Workspace for example Helloworld.jws

Check the Add a New OA Project and click OK.


After you click OK, you will see the Wizard Welcome screen. You can skip the welcome
screen and select Next.

Then we can see a window which asks for Project Name, Directory name and Default
Package, provide the details as follows.

Project Name:- (HelloWorldPRJ )

Directory Name:- (It will come by default it is the directory where


your projects store in the patch)
Default Package:- (“<sangu>.oracle.apps.po.HelloworldPrj”.
In this path your project will store)
Click on Next .
In Step 2 and 3 of Oracle Applications Project Wizard we can see Connection details and
Responsibility details which we added early in JDeveloper Configuration Steps so need not to
do anything. If u not added,

then give the details.

Click Next.
In Step 3 and 3 of Oracle Applications Project Wizard it will ask for runtime connection.
JDeveloper Configuration Steps we already set the default project properties so need not to
do any thing.

Click Next and then Finish.

STEP2:-
Create the Application Module.

Right click on the project select new and then select ADF Business Component, then select
Application Module as shown bellow

And Click ok.


After that we will get the window in that give the

Application module name:- (HelloworldAM).

The package will come automatically in that just give .server as shown bellow.

Click next, next …. And finish.

STEP3:-
Create the page.

Right click on the project select new, then select OA Components, then select page
Click ok.

After that we will get the window in that give the name for page

Name:- (HelloworldPG).

The package will come automatically in that just give .webui as shown bellow.

STEP4:-
Now we have to attach the application module for this page.

In the application navigator select the <pagename>.xml (HelloworldPG.xml) from the webui
structure.

After that it will show the page structure, select region1.


In the property inspector select

BC4J-- > AM Definition (select your AM).

Visual-- >
Window Title:- (HelloWorld).
Title :- (HelloWorld).

After that right click on <pagename>.xml (HelloworldPG.xml) ) from the webui structure
and select run.

After that u will get the desired output as shown below.


9. Regions in OAF

Regions in OAF

A region is a reusable container that holds items.

Regions can inherit properties from other regions

Now let us discuss the creation of regions in OAF page.

Create the workspace

Create the project

Create the Application Module

Create the page and attach the AM to the page.

These all steps u know in the previous Sample page creation project.

pageLayout Region:-

This is the top level region of every OAF page. It will create automatically when we create
the page.
header Region:-

Now let us see how to create the header Region and it’s properties.
Right click on the top level region and select new region.

Select the region and set the region style to header in the property inspector
Set the text for the region
Create some items in the region to verify how the items will display in the page.
Right click on the region select new item.

Set the prompt for the item in the property inspector.


Run the page to get the output.

messageComponentLayout Region:-
Right click on the top level region and select new region.

Select the region and set the region style to messageComponentLayout Region in the
property inspector

You can also set the rows and columns u want in the page the items will arrange in that
format only
Here u can’t set the prompt for the region.

Create the items in the region as we did in header region.

Set the prompt for the items .

Run the page to get desire output.


Adding submit button in messageComponentLayout Region

Right click on the messageComponentLayout Region select new their u will get only
message related items , so to add submit button first u take the messageLayout item.

Right click on messageLayout and select new item and in the property inspector select the
item style as submitButton
Run the page to get the output.

rowLayout Region:-

Right click on the top level region and select new region.

Select the region and set the region style to rowLayout Region in the property inspector.

For rowLayout Region we have the properties like Horizontal Alignment,Vertical Alignment.
In that we have default, left, right, center, top, bottom by default it will be default.

Row layout resion dispalays the output in row wise.


After creating the region add some items to the region.

Run the page to get the output.

defaultDoubleColumn Region:-

To display the items in two column we use this region.


Right click on the top level region and select new region.

Select the region and set the region style to defaultDoubleColumn Region in the property
inspector.
U can set the text for region.

After creating the region create some items in that .

Run the page to get the desired output.

The items should placed in two columns only.


defaultSingleColumn Region:-

To display the items in a single column we use this region.

Right click on the top level region and select new region.

Select the region and set the region style to defaultSingleColumn Region in the property
inspector.
U can set the text for region.
After creating the region create some items in that .

Run the page to get the desired output.

The items should placed in a single columns only.


pageButtonBar Region:-

PageButtonBar will be mostly used when u want the buttons in both top and bottom of the
page.

Right click on the top level region and select new region.

Select the region and set the region style to pageButtonBar Region in the property inspector.

Create the button in the region which u want.


After creating the items run the page.

query Region:-

Query Region is useful while creating the search page.

table Region:-
Table region is used to display the data in table format.
It is useful while displaying the data from the database.

stackLayout Region:-

Stack Layout region is used while displaying the data of flexfield.

train Region:-

Train region is used in multi transaction pages.


10. Items in OAF

Items in OAF

There so many item styles in the OAF to display the data now we will discuss some of
the most frequently used item styles.

Create one project and create one page under this page create one region.

messageTextInput Item:-

Message text input item will used to enter values. There the user can enter the details.

For example email,password etc.

First create two items and select the item and go to property inspector set item style as
messageTextInput.

To make the fields mandatory in the property inspector set showRequired to TRUE.

To make the texts in disable mode like we write the passwords in property inspector set the
secret to TRUE.

If u want u can change the CSS style also.


Run the page to get the output.

messageStyledText:-
To display the data in a read only format use the message style text item.

Create the item select the item style as messageStyleText in the property inspector.

Run the page to get the output.

messageCheckBox Item:-

Create the item select the item style as messageCheckBox in the property inspector.

For messageCheckBox item we have to set some default properties.

Initial Value:- Y (By default if u want to check the check box give the value Y).
Checked Value:-ONE(By default which check box u want to check give that value).

Unchecked Value:-TWO(By default which check box u want to uncheck give that
value).
Initially Checked:-TRUE (By default if u want to check set the value to true).

Run the page to get the output.

messageRadioButton Item:-
Create the item select the item style as messageRedioButton in the property
inspector.

We can create and check all the radio buttons .

To check the single value we have to create one group for all the radio buttons
programmatically.

For this first we have to create the controller.

Right click on main region and select set new controller.


Give the name for the controller.

By default in package we will get two webui just remove one webui.

After this it will open the controller and write the code their.
/*For Copy Paste*/

public void processRequest(OAPageContext pageContext, OAWebBean webBean)


{
super.processRequest(pageContext, webBean);
//To retrive the radio buttons
OAMessageRadioButtonBean
mrb=(OAMessageRadioButtonBean)webBean.findChildRecursive("MRB1");
/*set the group name for the radio buttons.*/
mrb.setName("Gender");
/*set the value for particular radio button.*/
mrb.setValue("male");

OAMessageRadioButtonBean
mrb3=(OAMessageRadioButtonBean)webBean.findChildRecursive("MRB2");
mrb3.setName("Gender");
mrb3.setValue("female");

Then run the Page to get the output.


messageChoice Item:-

Create the item select the item style as messageChoice in the property inspector.

For message choice we need a view object so first create the view object.

Right click on project select new.

ADF Business Component---- >View Object

Click ok.
After that a welcome window will come just click next.

In next window it will ask for the view object name and the package will come automatically
once check the package.

Name :- DepartmentVO

Package:- (sangu.oracle.apps.po.HelloworldPRJ.server)
Click next, next…..

In step 5 it will ask for the query write the query for which items u want in the
message choice.
Click next ..

In step 8 check both the generate jave files.

 VOImpl.
 VORowImpl.
Click next and finish.

Attach the VO to AM

Right click on AM Select Edit AM

There move your VO from left to right.


Ok now lets come to our item select the item set the following property.

Prompt:-Department (Any name u want to display)

View Instance : -Select your view object name from lov( DepartmentVO1).

View Attribute:- select the column which u want to display in the message choice (Dname).

Picklist View Definition:- Give the path of the vo

(sangu.oracle.apps.po.HelloWorldPRJ.server.DepartmentVO)

Picklist View Instance:- Give the VO name (DepartmentVO).

Picklist Display Attribute:- Which values u want to display (Dname).

Picklist Value Attribute :- which values it shold take from vo(Dname).


Run the page to get the output.

messageRichTextEditor Item:-
Create the item select the item style as messageRichTextEditor in the property
inspector.

messageRichTextEditor item is used if the user want to give more details we use this.

For ex writing Summary, Address etc.

Give the prompt for the item.

Run the page to get the output.

Image Item:-

If u wants to insert any image in the OAF page then we we will use the image item.

We cannot take image item directly in messageComponentLayout region for that


first we have to
take messageLayout and within that create the item and select the item set item style
as image in
property inspector.
To display the images first we have to put our image in the server.

All the images in server are stored in OA_MEDIA directory.

Copy the image in OA_MEDIA. To know the path open the putty type $OA_MEDIA

It will give the OA_MEDIA directory

Type pwd it give the path and place your image in that.

Here we are using WinSCP to move the file to server.


Next Copy the image in the local machine Jdeveloper patch OA_MEDIA directory also.
jdevhome\jdev\myhtml\OA_MEDIA

To display the image in page we have to set some property in the property inspector of that
item
Visual--- >
Image URI-- > /OA_MEDIA/rose.jpg

Run the page to get the output.


11. Displaying Exception in OAF page

Displaying Exception in OAF page

Now we are going to know how to populate the exception message when a button pressed.

Create one project.

Create one page.

Create one region in that create two items one messageTextInput and another
submitButton.

Create one controller in the main region and write the code in the controller to display the
exception message whenever we click the submit button.

After that u will get the window their give the controller name and in package by default u
will get two webui just remove one.
Write the following code in the controller processFormRequest

/*For Copy Paste*/

public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)


{
super.processFormRequest(pageContext, webBean);

//Handle the submit button

if(pageContext.getParameter("Go")!=null)
{
//Capture the values of the item

String s= "Hi "+pageContext.getParameter("item1");


throw new OAException(s,OAException.INFORMATION);
}
}

For exception first we have to import the following package.

import oracle.apps.fnd.framework.OAException;

There is no need to write the import package explicitly while writing in code it will show one
pop up for import at that time just press Alt+Enter.

In the above code throw is the reserve keyword for exception.

Item1 is the ID of the messageTextInput item.

Go is the id of the submit button.

Run the page to get the desired output.


12. Displaying Data from Database

Displaying Data from Database in OAF


For displaying the data from the database first we have to.

Create the workspace and project.

Create the AM.

Create the page and attach the AM to the main region of the page.

Next create one VO as follows.

Right click on the project select new. Then ADF Business Component Then View Object and
select OK.

After that u will see the welcome window just click next.

In next window give the View Object Name.

Name:- (DataDisplayVO).

Package:- will come by default.

Click next.
After that just click next, next and in step 5 of 8 write the sql statement for the VO.

select * from fwk_tbx_employees

Click next, next and in the step 8 of 8 just check the generate java file.
Click next and finish.

Next we have to attach this VO to the AM.

Right click on AM select edit AM.

In that select the VO and move that as shown below.


Click Apply and OK.

Next come to the page create on button

Name :- Get Details.

Next create one table region to display the data.

Right click on main region select new Region using wizard.


Next u will get one welcome window just click next .

In next step select your AM from the list and it will show the VO attached to it.
Click next .

In next step

Region ID :- your View instance name(DataDisplayVO1).

Region Style:- Select table (table).


Click next ..

In next step move which ever attributes u want to display.


Click next, next and finish.

Now we have to create one controller.

Right click on main region select set new controller.

Next give the name for the controller.

Package:- by default two webui will come just remove one webui.

Class Name:- Give the name (DataDisplayCO).

For displaying the data write the following code in the process form request.
/*For Copy Paste*/

public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)


{
super.processFormRequest(pageContext, webBean);
if(pageContext.getParameter("Go")!=null)
{
/* The below code line is used to initialize the application module */
OAApplicationModule
am=(OAApplicationModule)pageContext.getApplicationModule(webBean);
/* The below code line is used to initialize VO*/
OAViewObject vo=(OAViewObject)am.findViewObject("DataDisplayVO1");
/* DataDisplayVO1 is the instance name in AM which is the original name of the VO */
vo.executeQuery();
}
}

Next run the page to get the desired output.

After clicking the Get Details button it will display the details.
If u want to clear the data den first create one button called “Clear” and write the following
code in processFormRequest.

/*For Copy Paste*/


public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processFormRequest(pageContext, webBean);

/* The below code line is used to initialize the application module */


OAApplicationModule
am=(OAApplicationModule)pageContext.getApplicationModule(webBean);
/* The below code line is used to initialize VO*/
OAViewObject vo=(OAViewObject)am.findViewObject("DataDisplayVO1");
/* DataDisplayVO1 is the instance name in AM which is the original name of the VO */
if(pageContext.getParameter("Go")!=null)
{
vo.setWhereClause(null);
vo.setWhereClause("1=1");

vo.executeQuery();
}
/*To clear the data form the table region */
if(pageContext.getParameter("Clear")!=null)
{
vo.setWhereClause(null);
vo.setWhereClause("1=2");
vo.executeQuery();
}
}

Run the page to see the output.


13. Inserting Data into Database

Data Entry page in OAF

For data entry

First create one workspace and project.

Create the AM.

Create the page and attach the AM to the main region of the page.

For Data Entry or any DML operation we need to create the Entity Object.

Steps to create the EO.

Right click on the project select new and then ADF Business Component And Entity Object.

Click ok, After that u will get the welcome window just click next.

In next window

Package :- Select your package from the list. And add the schema.server.
(sangu.oracle.apps.po.DataDisplayPRJ.schema.server)

Schema Object :- Select the table, view ,synonyms or materialized view on which u want to
create the EO
Below that click the respective check box den only u will get them in the
list.

Click next, next in step 3 of 5 if u want u can set the attributes like primary key etc.
Click next there u check in generate java all the check boxes as shown below.
Click next . In next if u want u can create the VO based on this EO directly.

Just give the VO name. then click next next and finish.

After creating the EO and VO u just attach this VO to AM.


Next come to the page and create one messageComponentLayout Region in that create the
items for which u want to insert the data.

And create two submitButtons for saving the data and clearing the data.

Now set the following properties for each item except submitButton

View Instance:- Select the view instance from the lov


View Attribute:- Select the attribute u want, from the lov.
And set the proper data type and prompt for each item.

If u want the space between the buttons then create one item set the style as spacer
And set the property.

Width: Give some distance (20)

After completing the page structure now write the following code in the java file of the AM.

Select the AM in structure it will show the DataDisplayAMImpl.java just double click on
that.
U will get the window.
In that java file create one method for inserting the data.

/*for copy paste*/

public void insertData()


{
/*Write the following code to initialize the VO*/
OAViewObject vo = getFwkTbxEmployeesEOVO1();
if(!vo.isPreparedForExecution())
{
vo.executeQuery();
}
/*write the following code to create one empty row */
OARow row=(OARow)vo.createRow();
/*write the following to isert the data*/
vo.insertRow(row);
}

Create another method for saving the data.

/*for copy paste*/

public void Save()


{
getOADBTransaction().commit();
}

After creating the methods in AM java file create one controller and call these methods in
that.

Write the following code in processRequest of the controller.

/*for copy paste*/

public void processRequest(OAPageContext pageContext, OAWebBean webBean)


{
super.processRequest(pageContext, webBean);
/*for initializing the AM */
OAApplicationModule
am=(OAApplicationModule)pageContext.getRootApplicationModule()
;

/*invoke the method which u write for inserting data */


am.invokeMethod("insertData");
}

Write the following in the processFormRequest of the controller.


/*for copy paste*/

public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)


{
super.processFormRequest(pageContext, webBean);

/*for initializing the AM */


OAApplicationModule
am=(OAApplicationModule)pageContext.getRootApplicationMod
ule();

if(pageContext.getParameter("Save")!=null)
{
/*invoke the method which u write for saving the data */
am.invokeMethod("Save");
/* for throwing confirmation message*/
throw new OAException("Data Entered Successfully”,
OAException.CONFIRMATION);
}
}

Run the page to get the output.


After clicking the Clear button if u want to clear the fields write the following code in
processFormRequest.

/*for copy paste*/

if(pageContext.getParameter("Clear")!=null)
{
OAMessageTextInputBean msb1 =
(OAMessageTextInputBean)webBean.findChildRecursive("EmployeeId");
msb1.setValue(pageContext,null);
OAMessageTextInputBean msb2 =
(OAMessageTextInputBean)webBean.findChildRecursive("Title");
msb2.setValue(pageContext,null);
OAMessageTextInputBean msb3 =
(OAMessageTextInputBean)webBean.findChildRecursive("FirstName");
msb3.setValue(pageContext,null);
OAMessageTextInputBean msb4 =
(OAMessageTextInputBean)webBean.findChildRecursive("LastName");
msb4.setValue(pageContext,null);
OAMessageTextInputBean msb5 =
(OAMessageTextInputBean)webBean.findChildRecursive("PositionCode");
msb5.setValue(pageContext,null);
OAMessageTextInputBean msb6 =
(OAMessageTextInputBean)webBean.findChildRecursive("Salary");
msb6.setValue(pageContext,null);
}
14. Partial Page Rendering (PPR) in OAF

Partial Page Rendering (PPR) in OAF

PPR is a technology that lets you refresh a specific part of a page when you want to make a
UI change instead of having to refresh (redraw) the entire page.
Gives users a more responsive and interactive application
Improves application Performance

Steps for Partial Page Rendering:-


First create one workspace and project.
Create the AM.
Create one Page and attach the page AM to it.
Create one Entity object and VO and attach to AM.
Create the controller.

For PartialRendering here I am using my data insert project only.

The structure of my data insert project is like this.


The output of my Data Insert page is like.

For partial Rendering in the above example

If the position code is “DIRECTOR” it should hide the managerID

For this first make the position code item as message choice.

position-->itemStyle-->messegeChoice

DATA-->
piclistViewInstance-->Give the view instance name
PicklistDisplayAttribute-->what we want to display in message
choice
the column name of that(Meaning)
PiclistValueAttribute-->what value shuld take.

Next create one PartialVO without any query.

And after that create one transient attriobute.

Right click on PartialVO and select edit.


Click new.

U will get the window for creating new attribute set the following properties.

Name:- ManagerIDRendered

Type:- BOOLEAN.

Click Apply and ok.


After creating the partialVO.

Select the positionCode item and in the property inspector set the following properties.

Client Action---- >

Action Type-- > firePartialAction.

Event --- > positionEvent.


Select the managerID item and set the following properties

managerid-->visual
->Rendered-->${oa.<Partial View Instance Name>.<New Attribute
Name>}

${oa.PartialVO1. ManagerIdRendered}
Create one method in AM java file

public void Partialvo()


{
OAViewObject vo=getPartialVO1(); //we have to create one new partialvo
if(!vo.isPreparedForExecution())
{
vo.executeQuery();
}

OARow row=(OARow)vo.createRow();
vo.insertRow(row);
vo.first().setAttribute("ManagerIdRendered",Boolean.TRUE);

Create the method for hide and show of managerID

public void showManager(String PositionCode)


{
OAViewObject vo=getPartialVO1();
if(PositionCode.equalsIgnoreCase("DIRECTOR"))
{
vo.first().setAttribute("ManagerIdRendered",Boolean.FALSE);
}
else
{
vo.first().setAttribute("ManagerIdRendered",Boolean.TRUE);
}
}

Write the following code in processRequest of the controller.

OAApplicationModule
am=(OAApplicationModule)pageContext.getRootApplicationModule();

//call the method we created for creating new row

am.invokeMethod("Partialvo");

Write the following code in the processFormRequest.

if(eventName.equalsIgnoreCase("positionEvent")) //the event name that we given in


position column
{
String position=pageContext.getParameter("PositionCode"); //the id of the position
column

Serializable [] parm={position};
am.invokeMethod("showManager",parm);//we have to call the method that we created
for showing managerid
}
}

Run the page to see the output.


If u select the position as director the manegerID should hide.
15. Calling one page to Another page in OAF

Calling one page to Another page in OAF

Now we are going to learn how to call one page from another page.

For this first we have to create one workspace and one project.

Next create one AM.

Create two pages one for data display and another for data entry.

Attach the AM to both the pages.

Now here I am not creating the pages once again I am using my previous data display and
data entry page only.

Create the controller for each page.

Now when we click the create employee button it should redirect to data entry page.

For calling one page from another we have a method called pageContext.setForwardURL.

Write the following code in the processFormRequest of data display page controller( i.e
in the first page controller.)
/*For Copy pasting the code */

if(pageContext.getParameter("createEmployee")!=null)
{ pageContext.setForwardURL("OA.jsp?page=/sangu/oracle/apps/po/DataDispla
yPRJ/webui/DataInsertPG",
null,
OAWebBeanConstants.KEEP_MENU_CONTEXT,
null,
null,
true,
OAWebBeanConstants.ADD_BREAD_CRUMB_YES,
OAWebBeanConstants.IGNORE_MESSAGES);
}

"OA.jsp?page=/sangu/oracle/apps/po/DataDisplayPRJ/webui/DataInsertPG"

Complete path of the OAF page.

Null: - If we want to call oracle apps form then in first line Destination page path is null and
here we will give the function name of the form. Line1 and Line2 are interlinked.

KEEP_MENU_CONTEXT:- We can include any number of menus as we require.

Null: - if we want only one particular menu then here we will specify that menu name and in
line3 we need to pass null, line3 and line4 are interlinked.

Null (parameter):- If we want to carry the values then we pass those values here.
True (Retain AM): generally this will be set to true value.

ADD_BREAD_CRUMB_YES:- If we want the link to carry to next page and store in the
memory.
IGNORE_MESSAGES:- It will restrict the messages to not to carry from one page to
another.

Run the page to see the output.

After clicking the Create Employee Button it will go to Data Entry page.

If u want go back to previous page then create one button in this page and write the code in
this page controller.
16. Search page in OAF

Search page in OAF

For Search page First create on workspace and project.

Create one AM.

Create the page and attach the AM.

Create the VO with following query.

SELECT * FROM fwk_tbx_employees


WHERE EMPLOYEE_ID LIKE NVL(:1, EMPLOYEE_ID)
AND FIRST_NAME LIKE NVL(:2, FIRST_NAME)

Attach the VO to AM

The structure of the page is as follows.

Create two message text input items for the input


Such as EmployeeId and Name

Create three button for search, clear and create new employee.

Create on table region for displaying searched items.

Right click on main region select new-- > Region using Wizard.

First u will get the welcome window just click next .

In next window select your AM and VO.


Click next.
In next window select region style as table.
In next step select the attributes u want to display.

Click next next and finish.

The final page structure is as follows.


Still now we have not yet write any code for serch.

Create one method in AMImpl.java file for search


public void Searchemp (OAPageContext pc, OAWebBean wb)
{
String eno = null;
String ename = null;

OAViewObject vo= getSearchVO1();


if(pc.getParameter("item1")!=null) //id of the search item
{
eno = pc.getParameter("item1").toString();
vo.setWhereClauseParam(0,eno);
}
else
{
vo.setWhereClauseParam(0,null);
}
if(pc.getParameter("item2")!=null)
{
ename =pc.getParameter("item2").toString();
vo.setWhereClauseParam(1,ename);
}
else
{
vo.setWhereClauseParam(1,null);
}

vo.executeQuery();
}

Next create one controller in search page.

Write the following in the processFormRequest of the controller.

searchAMImpl am= (searchAMImpl)pageContext.getApplicationModule(webBean);

//For search after clicking the search button

if(pageContext.getParameter("item3")!=null) //id of search button


{
am.Searchemp(pageContext,webBean);
}

//To clear the fields after cliking the clear button.

if(pageContext.getParameter("item4")!=null) //id of clear button


{
OAMessageTextInputBean mstb =
(OAMessageTextInputBean)webBean.findChildRecursive("item1");
mstb.setValue(pageContext,null);
OAMessageTextInputBean mstb1 =
(OAMessageTextInputBean)webBean.findChildRecursive("item2");
mstb1.setValue(pageContext,null);

//To call the create employee page after clicking the create employee button.

if(pageContext.getParameter("item5")!=null) //id of add new employee


{
pageContext.setForwardURL("OA.jsp?page=/sangu/oracle/apps/po/PPRPRJ/webui/Emp
loyeeCreationPG",
null,
OAWebBeanConstants.KEEP_MENU_CONTEXT,
null,
null,
true,
OAWebBeanConstants.ADD_BREAD_CRUMB_YES,
OAWebBeanConstants.IGNORE_MESSAGES);
}

Run the page to see the output.


17. Update Page in OAF

Update Page in OAF

Now we are going to learn how to update the records in database.

For that now create the page for update and attach the AM.

Create the items similar to Employee Creation page or Go to Employee Creation page and
copy the region and paste here.

Next create two button for update and cancel.

The page structure of update page is like this.

Create one controller for Update page.

For update first create one item in the search page for update.

Set the following properties.


Item style:- image

Image URI:-/OA_MEDIA/<name of the image> (/OA_MEDIA/updateicon_enabled.gif)

Copy the image in both server and local machine OA_MEDIA directory.

Client Action :-

Action type:- fire Action

Event :- update.

Parameters:-

name:- Any name (uemp)

Value:-${OA.<Search page view instance>.<Primary key attribute name>}


${oa.SearchVO1.EmployeeId}

the page look like as follows.

After clicking the update icon it should call the upadate page along with the data.

For that write the following code in the controller of search page in processFormRequest

if("update".equals(pageContext.getParameter(EVENT_PARAM)))
{
pageContext.setForwardURL("OA.jsp?page=/sangu/oracle/apps/po/searchPRJ/webui/U
pdatePG",
null,
OAWebBeanConstants.KEEP_MENU_CONTEXT,
null,
null,
true,
OAWebBeanConstants.ADD_BREAD_CRUMB_YES,
OAWebBeanConstants.IGNORE_MESSAGES);
}

Note:-
In the above code update is the event name given in the item properties

After calling the update page it should carry the data also.

i.e on page load of update page it should display the data of selected record for that write the
following code in processRequest of update page controller.

/*For Copy Paste */

public void processRequest(OAPageContext pageContext, OAWebBean webBean)


{
super.processRequest(pageContext, webBean);

/* Initialize the AM */

searchAMImpl am= (searchAMImpl)pageContext.getApplicationModule(webBean);

/* Check for parameter */

/* uemp is the name of the parameter given in the item properties of upadate item */
if(pageContext.getParameter("uemp")!=null)
{
String hid = pageContext.getParameter("uemp").toString();
/*EMPLOYEE_ID is the column name in the database */
String whereclause = "EMPLOYEE_ID='"+hid+"'";
am.getEmployeesVO1().setWhereClause(null);
am.getEmployeesVO1().setWhereClause(whereclause);
am.getEmployeesVO1().executeQuery();
}
else
{
/* If there is no data then call create employee method */

am.insertData();
}

After click on update image it will call update page along with data The output will look like
this.

After making all the changes and on click of the update it should save the updated data for
that

Write the following code in processFormRequest of update page controller.


/*For Copy Paste */

public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)


{
super.processFormRequest(pageContext, webBean);

/* Initialize the AM */

searchAMImpl am= (searchAMImpl)pageContext.getApplicationModule(webBean);

/*For updating the data */

if (pageContext.getParameter("item1")!=null) //id of update button


{
am.getOADBTransaction().commit();
throw new OAException("Employee Data Updated
Successfully",OAException.CONFIRMATION);
}

/* After clicking the cancel button it shuld redirect to search page */

if(pageContext.getParameter("item2")!=null) //id of cancele button


{
pageContext.setForwardURL("OA.jsp?page=/sangu/oracle/apps/po/searchPRJ/webu
i/SearchPG",
null,
OAWebBeanConstants.KEEP_MENU_CONTEXT,
null,
null,
true,
OAWebBeanConstants.ADD_BREAD_CRUMB_YES,
OAWebBeanConstants.IGNORE_MESSAGES);
}
}

Run the page to see the output.

After making the changes on the page.

After click on update button it will update the data successfully.


To check once again go back to search page and search the record it will display the updated
data.
18. Registration of OAF Page in Apps

Registration of OAF Page in Apps.

Now we are going to learn about how to register the pages in apps.

First create the page in JDeveloper and compile the page.

After compiling the page now we have to move the class files to Java top in server.

Step1:-Move the class file from local machine to $java top

local machine path:- <JDeveloper patch directory>/jdevhome/jdev/myclasses


the class file is located in this folder move that to

Server path:- /oracle/apps/r12/visr12/apps/apps_st/comn/java/classes


Move the whole folder where your project located.

Here I am using WinSCP tool to move the files.

Step2:- XML import utility

After moving the files to the server we to import the xml files.
Open the command prompt.

change the directory to:- C:\dev\oaf\jdevbin\oaext\bin


after that import the following:-
make the fallowing path in a single line for that in notepad go format uncheck word
wrap:-

import
C:\dev\oaf\jdevhome\jdev\myprojects\sangu\oracle\apps\po\searchPRJ\webui\SearchP
G.xml -rootdir C:\dev\oaf\jdevhome\jdev\myprojects -username apps -password apps -
dbconnection
"(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ebsr12.com)(PORT=1521))
(CONNECT_DATA=(SID=visr12)))"

NOTE
C:\dev\oaf\jdevhome\jdev\myprojects\sangu\oracle\apps\po\searchPRJ\webui\SearchP
G.xml
(This is the path where the oaf pages stores in our local machine)

Give the proper username, password, host name, port name, db name)

From unix server:

Run the below command from the path.

$JAVA_TOP/sangu/oracle/apps/po/searchPRJ/webui

java oracle.jrad.tools.xml.importer.XMLImporter
$JAVA_TOP/sangu/oracle/apps/po/searchPRJ/webui/SearchPG.xml -rootdir $JAVA_TOP -
username apps -password apps -dbconnection
"(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ebsr12.com)(PORT=1521))(CO
NNECT_DATA=(SID= vis12)))"

Step3:- Login to Oracle Apps

Switch to Application Developer Responsibility Select Function.

Application Developer--- > Function

Create a function

Name:- (EMP_SEARCH)

User Function Name:- (EMP_SEARCH)


After that go to Properties tab and select as

Type:- SSWA jsp function

Next Go to Web HTML tab and give the path of your page

HTML Call:- OA.jsp?page=/sangu/oracle/apps/po/searchPRJ/webui/SearchPG


Save and exit.

Step4:- Create a menu-attach the function

Application Developer--- > Menu

Provide the following details.

Menu:- (SANGU_EMP)

User Menu Name:- (SANGU_EMP)

Menu Type:- Standard.

Next give :-

Seq:-

Prompt:- (Emp Search)

Function:- EMP_SEARCH (Give the function Name u have created).


Step5:-Crete the Responsibility and attach the menu.

System Administrater-- >Security-- >ResponsibilityDefine.

Provide the following

Responsibility Name:- (Sangu_OAF)

Application:-Purchasing.

Rsponsibility Key :- (SANGU_OAF)

MENU :- SANGU_EMP (Select the menu that u have created)

DataGrup
Name:-Standered

Application:- Purchasing.
Step6:-Attach the responsibility to user.

System Administrater-- >Security-- >User -- >Define.


This finishes the registration Switch to the responsibility u created .

U will see the page.


19. Personalization in OAF

Personalization in OAF

Now we are going to learn how to do the personalization in OAF page.

Personalization is making changes in the page without touching the code.

Steps for personalization:-

For doing personalization first we have to enable the personalization.

Login to Apps

Switch to:- Functional Administrator Responsibility--

Core Services
Profile

In the profile page search for Personalize Self-Service Defn

Initially the profile value is NO

Click on Update Value make the value YES and update

Now the personalization will enable.

Go to the page on which u want do the personalization.

Ex1:- Adding an item to the page

Click on about this page and analyze the structure of the page.

If u wants to add an extra column then check which VO is attached to that and click
on that VO,

It will give u all the column attribute names and type which are attached to the VO

Note down the attribute name of the column which u want to add.

Go back to the page


Click on Personalize Page it's in top of the page

After that it will give the structure of the page.

In the page structure click on expand all it will displays all the items of the page

Find out the table in which u want to insert the column

In the item level scope click on create item it will populate one page there give the following
info
Level:-site

Item Style :-( Any one) Message Text Input

ID :-( Any name)

Admin Personalization:-True

Prompt :-( Any name)

View Attribute :-( Give the view attribute name of the item that u want to add)

View Instance :-( Give the view instance name for which this table attached)

Then Apply.
The column is successfully added return back to the page and see the new column will
populated on the page.

Ex 2:- Reorder the items position.

First click on personalization then it will display the structure of the page.

In the structure in table level scope click on Reorder.


After that it will display another window there u can set the positions.

And click Apply.


Return back to page and see the position.

Ex 3:-Changing the prompt of the item.

First click on personalization then it will display the structure of the page.

In that select the item u want change the prompt and click on update icon.
After that it will populate the window there give the prompt name what u want.

And click on Apply.

Return back to page and see the result.


Ex 4:- To hide the item.

To make field read only etc.

First click on personalization then it will display the structure of the page.

In that select the item and click on update icon.

For

Read only --- > True (To make read only set true)

Rendered--- > False (To hide the button set False)

Required--- >Yes (To make mandatory set Yes)


20. Calling D2K Form From OAF page

Calling D2K Form From OAF

Now we are going to learn about how to call the D2K form from OAF page.

The steps are As follows.

Create the workspace and project.

Create the Application Module.

Create the page and attach the AM and give the window title and title for that page.

Create one Submit button in the page.


After clicking that button it should call the form.

Create one controller to write the code.

Write the following code in the controller.

/* For copy paste */

public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)


{
super.processFormRequest(pageContext, webBean);

if(pageContext.getParameter("submit")!=null) //give the id of the submit button.


{
//form:APPLICATION_SHORT_NAME:RESPONSIBILITY_KEY:DATA_GROUP_
NAME
//:FORM_FUNCTION_NAME
String destination =
"form:SYSADMIN:SYSTEM_ADMINISTRATOR:STANDARD:FND_FNDSCAUS"
;

pageContext.forwardImmediatelyToForm(destination);
}
}

Run the page to see the output.

After clicking the button it will call the Respective form.

If u want pass the parameter then use the following syntax.

form:responsibilityApplicationShortName:responsibilityKey:securityGroupKey:functio
nName:param1=value1 param2=value2 param3=value3
21. Search page using Query Region

Search page using Query Region

First create one workspace and project.

Create one AM.

Create the page and attach the AM to page.

Create the VO.

select * from fwk_tbx_employees

Attach VO to AM.

Select the page in main region right click select new region and set the Region style as query.

And in the property inspector set the following property.

Construction Mode--- >resultBasedSearch.


Right click on query region select new-- > Region using Wizard.

First u will get the welcome window just click next .

In next window select your AM and VO.


Click next.
In next window select region style as table.
In next step select the attributes u want to display.

Click next, next and finish.

The structure of the page is as follows.


For each item set the property search allowed to true

Run the page to see the output.

If u use Query region then there is no need to create search and clear button they will come
automatically
22. Invoking sequence in OAF Page

Invoking sequence in OAF Page

To invoke the sequence number in the OAF page then write the following code in the setter
method of the required column in EOImpl.java file.

//For Copy Paste//

public void create(AttributeList attributeList) {


super.create(attributeList);

OADBTransaction transaction = getOADBTransaction();


// To get the employee id through sequence
Number employeeId =
transaction.getSequenceValue("FWK_TBX_EMPLOYEES_S");
setEmployeeId(employeeId);

// Start date should be set to sysdate


setStartDate(transaction.getCurrentDBDate());
// end create()
}
OR
If you want to write in controller write the below code in processRequest of controller class.

OADBTransaction transaction = (OADBTransaction)am.getOADBTransaction();


Number seqvalue= transaction.getSequenceValue("FWK_TBX_EMPLOYEES_S");
System.out.println("seqvalue-->"+seqvalue);
OAMessageStyledTextBean mcb =
(OAMessageStyledTextBean)webBean.findChildRecursive("EmpId");
mcb.setValue(pageContext,seqvalue);

The Desired output shulde like.


23. Calling the Procedure in OAF

Calling the Procedure in OAF

Now we r going to learn about how to call the procedures in oaf page.

First Create the work space and project.

Create the AM.

Create the page and attach the AM.

Create one new region in the page of style messageComponentLayout.

Create two items of style messageTextInput and data type number.

Create one submit button.

The structure of the page looks like as follows.

Now we have to create one package and package body to call that in OAF page.

//Package Specification
//Addition of two numbers.

CREATE OR REPLACE PACKAGE APPS.proc_in_oaf AUTHID CURRENT_USER


IS
PROCEDURE addition
( item1 IN NUMBER,
item2 IN NUMBER,
addition OUT NUMBER
);
END proc_in_oaf;
//Package Body
CREATE OR REPLACE PACKAGE BODY APPS.proc_in_oaf
IS
PROCEDURE addition
( item1 IN NUMBER,
item2 IN NUMBER,
addition OUT NUMBER
)
IS

BEGIN

addition := item1 + item2;

END addition;

END proc_in_oaf;

After creating the procedure,

Create the method in the AMImpl.java file for calling the and executing the procedure.

public String AddNumber(String item1,String item2)


{ OADBTransaction oadbtransaction = (OADBTransaction)getTransaction();
OADBTransactionImpl oadbtransactionimpl =
(OADBTransactionImpl)getTransaction();
String retValues;
StringBuffer str = "Begin proc_in_oaf.addition(:1,:2,:3); End;";

OracleCallableStatement oraclecallablestatement =
(OracleCallableStatement)oadbtransaction.createCallableStatement(str.toString(),
1);
try{
oraclecallablestatement.setFloat(1, Float.parseFloat(item1) );
oraclecallablestatement.setFloat(2, Float.parseFloat(item2) );
oraclecallablestatement.registerOutParameter(3, Types.VARCHAR);
oraclecallablestatement.execute();

retValues = oraclecallablestatement.getString(3);
}
catch(Exception e)
{
throw OAException.wrapperException(e);
}
return retValues;
}

Next create one controller in the page .

And call the method in the processFormRequest.

//FOR Copy Paste

public void processFormRequest(OAPageContext pageContext, OAWebBean


webBean)
{
super.processFormRequest(pageContext, webBean);

OAApplicationModule am = pageContext.getApplicationModule(webBean);

if (pageContext.getParameter("item3") != null)
{
Serializable[] parameters1 = { pageContext.getParameter("item1"),
pageContext.getParameter("item2"),
};

String retVals1 = (String)am.invokeMethod("AddNumber", parameters1);


String message = "Sum: " + retVals1;
throw new OAException(message, OAException.INFORMATION);

This completes the project.

Run the page to see the output.

After click on ADD button it will give the addition of two numbers.
24. Creating Train Region in OAF

Train Region in OAF

Now we are going to learn about, how to use the train region in oaf.

For train region.

First create one workspace and project.

Create one Application Module.

Here I am using data insertion. So create one Entity Object. (Not Mandatory)

Create one View Object and attach to AM.

Create three pages and attach the AM and set the window title and title for each pages.

The Structure of the pages are as shown below.

Train1PG

For each item set the View Instance and View Attribute.

Train2PG

For second page in the main region along with AM definition set one more property called
AM State Required to TRUE.
Train3PG

For third page also make AM State Required to TRUE.

Next Create one new Region.

Right click on webui select new.

Webui-- > new -- >OA Component -- > Region.

Give the name for the Region

Name:- (EmpTrainRN)

Style:-train
After creating the Region in the structure. Right click on the region select new link

Create three links.

Set the following properties for the link.

ID:- (STEP1)

Destination URI:- Give the path of the 1 page


(OA.jsp?page=/sangu/oracle/apps/po/TrainPRJ/webui/Train1PG)

Text:- (Step1)
Repeat the same for other two links also.

ID:- (STEP2)

Destination URI:- Give the path of the 2 page


(OA.jsp?page=/sangu/oracle/apps/po/TrainPRJ/webui/Train2PG)

Text:- (Step2)

ID:- (STEP3)

Destination URI:- Give the path of the 3 page


(OA.jsp?page=/sangu/oracle/apps/po/TrainPRJ/webui/Train3PG)

Text:- (Step3)

Create one more region for navigation of type pageButtonBar.

Right click on webui select new.

Webui-- > new -- >OA Component -- > Region.

Give the name for the Region

Name:- (EmpNavRN)

Style:-pageButtonBar
After creating the Region in the structure. Right click on the region select new item

Create one submit button item for save.

Id:-save
Style:-submitButton
Prompt:-save.

Create another submit button item for cancel.

Id:-cancel
Style:-submitButton
Prompt:-cancel.

Crete one region.

Style:-navigationBar

First Step:- 1

Last step :- 3

Create three links items in the navigationBar region.

Right click on the region select new item

Set the following properties for the link.

ID:- (step1link)

Style:- link
Destination URI:- Give the path of the 1 page
(OA.jsp?page=/sangu/oracle/apps/po/TrainPRJ/webui/Train1PG)

Text:- (Step 1 of 3)

ID:- (step2link)

Style:- link

Destination URI:- Give the path of the 2 page


(OA.jsp?page=/sangu/oracle/apps/po/TrainPRJ/webui/Train2PG)

Text:- (Step 2 of 3)

ID:- (step3link)

Style:- link

Destination URI:- Give the path of the 3 page


(OA.jsp?page=/sangu/oracle/apps/po/TrainPRJ/webui/Train3PG)

Text:- (Step 3 of 3)

The structure of the region is as follows.

After creating the EmpTrainRN region and EmpNavRN region.

Now click on your Train1PG

In this page create one Region.


Style:- pagebuttonBar

Extends:- Here give the path of your EmpNavRN region


(/sangu/oracle/apps/po/TrainPRJ/webui/EmpNavRN)

After this now write click on main region of the page and select new location.

After creating the location it will create one region in that Extend your train Region i.e
EmpTrainRN.
Repeat the same for remaining two pages also.

(One region for EmpNavRN region and one location for EmpTrainRN region)

The structure of the page looks as follows.

This finishes the Train Region Run The Page to See The Output.

U can add the data.

After clicking next button it move to next page.


After clicking next button it move to next page.
25. Prepared Statement in OAF

Prepared Statement in OAF


Write the following code in Controller.

import oracle.jdbc.OracleCallableStatement;
import oracle.jdbc.OracleConnection;
import java.sql.PreparedStatement;

OAApplicationModule oaapplicationmodule =
oapagecontext.getRootApplicationModule();

OADBTransaction oadbtransactionimpl = oaapplicationmodule.getOADBTransaction();


PreparedStatement preparedstatement = null;
ResultSet resultset = null;
OracleConnection conn = (OracleConnection)oadbtransactionimpl.getJdbcConnection();

try
{
String s1 = "SELECT count(*) FROM XXSY_ASE_SHIPPING_INFO where
SO_LINE_SHIPMENT=:1";
preparedstatement = conn.prepareStatement(s1);
preparedstatement.setString(1, salesOrderLineShippement);
resultset = preparedstatement.executeQuery();

if(resultset.next())
{
String vRowCount = resultset.getInt(1);
pageContext.writeDiagnostics(this, (new StringBuilder()).append("detail data
vRowCount:
= ").append(vRowCount).toString(), 2);

resultset.close();
preparedstatement.close();
}
}
catch(Exception e)
{
throw OAException.wrapperException(e);
}
26. Migrating OAF pages from one instance to another

Migrating the OAF Page from One Instance to Other

Let us take u are moving the page from DEV instance to TEST instance.

Step1:-Compile all the database related objects in TEST.

Step2:-Copy the folder from the DEV instance which u want to migrate to TEST instance
from $JAVA_TOP

Step3:- Move the copied folder to TEST instance in $JAVA_TOP.

Step4:- Run the xml import command from $JAVA_TOP/xxsy/oracle/apps/inv/eo/webui in


unix server.
($JAVA_TOP/path of the page)
java oracle.jrad.tools.xml.importer.XMLImporter
$JAVA_TOP/xxsy/oracle/apps/inv/eo/webui/EmpPG.xml -rootdir $JAVA_TOP -username
apps -password apps -dbconnection
"(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=focusthreadr12.com)(PORT=15
30))(CONNECT_DATA=(SID=R12TEST)))"

Step5:-Bounce the apache.

Step6:-Create the function in TEST as in DEV.

Step7:-Attach the function to menu.

This finishes the migration of page from DEV to TEST.


27. Adding Submit Button Programmatically.

Adding Submit Button Programmatically

To create the submit button programmatically write the following code in


controller.

public void processRequest(OAPageContext pageContext, OAWebBean webBean)


{

super.processRequest(pageContext, webBean);

//creating submit button through coding

OASubmitButtonBean subBtn=
(OASubmitButtonBean)pageContext.getWebBeanFactory().createWebBean(pageContext,"B
UTTON_SUBMIT");
subBtn.setID("SubBtn");
subBtn.setUINodeName("SubBtn");
subBtn.setEvent("Submit");
subBtn.setText("Submit ");
webBean.addIndexedChild(subBtn); /*in which region u want to add the button give the id of
that region in the above line (remove webBean and give the id of region).*/

}
28. Adding Message Lov Input through personalization.

Adding Message lov Input through personalization.

Now we are going to learn how to add the message lov input item through personalization.
Suppose if you want to add the new item to the existing page.

Step1:- Click on personalization.

Step2: - Go to the region where you want to add the item and click on create item.
Give the following details.

Item Style : - Message Lov Input.

Id : - Any unique id.

External Lov: - Give the path of the lov which u want to use for this item.

Prompt : - any name.

Click on apply.
Note: - If you want the new Lov, then create the lov vo and region based on which you want
and move that to server and run the import command for the region.

Step3: - After creating the message lov input item create one lov mapping under that.

Give the following details.

Item Style : - Lov Map.

Id : - Unique id.

Criteria item :- Which values u want for that item.

Lov region item:- On which column you created the lov.

Return item :- which values you want to display on the page.


Click on Apply.

Step4: - Return back to the page and see the new field is added successfully.
29. Uploading File to server from OAF Page

Uploading Flat File to server from OAF Page

Now we are going to learn about how to load the flat files to server from oaf page.
For uploading the files in OAF we have the item called “MessageFileUpload” using this we
can load the files.

Steps are as follows.

Step1: - Create the workspace and project.

Step2: - Create the application module.

Step3: - Create the page and attach the application module to the page and in properties
Give the window title and title.

Step4:- Create one region with style “message component layout” under page layout region
And create two items under message component layout one with style
“messageFileUpload” and second is a submit button.

The structure of the page is like below.

If u want any spaces between the items then create the item with style spacer.

Step5: - Create the controller for pageLayoutRegion.

Write the following code in the processFormRequest method of a controller

import oracle.cabo.ui.data.DataObject;
import java.io.FileOutputStream;
import java.io.InputStream;
import oracle.jbo.domain.BlobDomain;
import java.io.File;
import oracle.apps.fnd.framework.OAException;

public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)


{ super.processFormRequest(pageContext, webBean);

TFitFileLoaderAMImpl am =
TFitFileLoaderAMImpl)pageContext.getRootApplicationModule();

if(pageContext.getParameter("Submit")!=null)
{
am.uploadFile(pageContext,webBean);
}
}

Create a method called uploadFile in AMImpl.java

Otherwise you can create the method in controller only.


If you create method in controller then in the above code do not initialize Application
module and while calling the method use the bellow syntax.
uploadFile(pageContext,webBean);

import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.sql.Types;
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.framework.server.OAApplicationModuleImpl;
import oracle.apps.fnd.framework.server.OADBTransaction;
import oracle.apps.fnd.framework.server.OADBTransactionImpl;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.cabo.ui.data.DataObject;
import oracle.jbo.domain.BlobDomain;
import oracle.jdbc.OracleCallableStatement;

public void uploadFile (OAPageContext pageContext,OAWebBean webBean)


{
String filePath = “/Software/apps/apps_st/appl/xx/msd/tfit/”;

String fileUrl = null;

try
{
DataObject fileUploadData = pageContext.getNamedDataObject("Give the id of
message
file upload
item");

if(fileUploadData!=null)
{
String FileName =
(String)fileUploadData.selectValue(null, "UPLOAD_FILE_NAME");
String contentType =
(String)fileUploadData.selectValue(null, "UPLOAD_FILE_MIME_TYPE");
FileOutputStream output = null;
InputStream input = null;
BlobDomain uploadedByteStream =
(BlobDomain)fileUploadData.selectValue(null, FileName);

File file = new File(“/Software/apps/apps_st/appl/xx/msd/tfit”, FileName);


output = new FileOutputStream(file);
input = uploadedByteStream.getInputStream();
byte abyte0[] = new byte[0x19000];

int i;

while((i = input.read(abyte0)) > 0)


output.write(abyte0, 0, i);
output.close();
input.close();
}
}
catch(Exception ex)
{
throw new OAException(ex.getMessage(), OAException.ERROR);
}
}

Step6: - Register the page in server and run the page.


Brows the file and click on submit button it will store in server.
30. How to create TAB Page in OAF

How to create TAB Page in OAF

Now we are going to learn about how to create the tab pages in OAF

Steps to create Tab pages in OAF


Consider there are two pages.
Step1:-Create a function for each page that you want to display.
For first page while creating function in webHtml tab along with page path provide home
page menu name and function name.

OA.jsp?page=/xxsy/oracle/apps/msd/SYNDemantra/webui/SYNDemantraPG&OAHP=MSD_DEM_
HOMEPAGE_MENU&OASF=XXSY_DEM_IMP

For second page juct create a normal function.

OA.jsp?page=/xxsy/oracle/apps/msd/SYNDemantra/webui/UploadStatusPG

Step2:- Create a menu of type "HTML Tab" for each tab you want to display.

attach the first function you have created.


Create another one menu of type HTML TAB for second function.

Step3:- Create a menu of type "Home Page" .

Step4:- Add the tab submenus to the "Home Page" menu.

Add the tab menus in your desired display sequence from left to right. The leftmost tab
should be added first.
Remember to specify Prompt values for each tab submenu. These values display as the tab
text.

Step5:- Add your "Home Page" menu to your responsibility menu.


And add first function that u have created with specifying HomePage menu in there
web
html to responsibility menu.
Step6: - This finishes the creation of tab pages. Navigate to the responsibility and click on
the
function and see the page.

31. Adding HTML Tab/Menu to the standard OAF page.

Adding HTML Tab/Menu to the standard OAF page.


Now we are going to learn about how to attach the HTML Tab menu to standard OAF Page.

Steps to achieve this.

Suppose this is your standard page.

Step1:- Note down the Responsibility of this page.

Step2:- Note down the Menu attached to this Responsibility.

Step3:- Note down the home page menu attached to this Menu.

Step4:- Create a function for each page that you want to display.

ASIC Planning.
Navigation: Application Developer>Application>Function.
Enter the following details.
Step5:- Create a menu of type "HTML Tab" for each tab you want to display.

ASIC Planning Parameters.


Navigation: Application Developer>Application>Menu.
Enter the following details.

Add each function to its corresponding tab menu. Do not specify any Prompt values.

Step6:- Attach the menu to Home Page Menu which u note down in step 3 as sub menu.
Step7:- The Home page menu is attached to Menu which is attached to responsibility.

Now go to the responsibility and check the tab is added or not.


32. How to Bounce Apache Server in R12

How to Bounce Apache Server in R12

To bounce the Apache first connect to server through putty.

Now change the directory to INST_TOP

cd $INST_TOP

cd admin/scripts

Now run the below commands

 adapcctl.sh stop
 adapcctl.sh start

 adoacorectl.sh stop
 adoacorectl.sh start
33. How to ADD/Remove Global Buttons in OAF Page.

How to Add/Remove Global Buttons in OAF Page.


Now we are going to learn about how to add or remove global buttons from OAF
page.

ADD Global Buttons.

Oracle has created the standard menu for global buttons like(Home, Logout,
Preferences etc) called
ICX_STANDARD_GLOBAL_MENU to add these buttons just add this menu to your
menu which contains your page.

Disabling the Global Buttons

To disable the global buttons write the below code in the processRequest of your
page controller.

OAPageLayoutBean page = pageContext.getPageLayoutBean();

// You must call prepareForRendering() if the following code is


// included in a pageLayout controller. If you add it further down
// in the layout hierarchy, the menus will be fully processed so you
// don't need to do this

page.prepareForRendering(pageContext);
OAGlobalButtonBarBean buttons =
(OAGlobalButtonBarBean)page.getGlobalButtons();

// Hide the Global buttons

buttons.setRendered(false);

or
// Disable the Global buttons

buttons.setDisabled(true);
34. How to Add New Row to a Table Region in OAF

How to add new row to table region in OAF


Now we are going to learn about how to add a new row to table region.
Suppose we have a requirement that when we click on add button it has to create a new row
to enter the data.

Step 1:- Right click on table region select footer.

Step 2:- right click on table footer select new -- > addTableRow.

Write the below code in the processFormRequest of a controller

OAApplicationModule am =
(OAApplicationModule)pageContext.getRootApplicationModule();
OAAdvancedTableBean tableBean =
(OAAdvancedTableBean)webBean.findIndexedChildRecursive("PdqSystemParametersEOV
ORN");

OATableFooterBean footerBean = (OATableFooterBean)tableBean.getFooter();

if(footerBean != null)
{
OAAddTableRowBean addTableRowBean =
(OAAddTableRowBean)footerBean.findIndexedChild("addTableRow1");

if(pageContext.getParameter("event") != null &&


"addRows".equals(pageContext.getParameter("event")))
{
am.createAnotherRow();
DBTransaction dbt = am.getDBTransaction();
dbt.commit();
}
}

Create one method called createAnotherRow() in am.

public void createAnotherRow()


{
Row row1 = null;
OAViewObject VO1 = null;
VO1 = getPdqSystemParametersEOVO1();
row1 = VO1.createRow();
VO1.setCurrentRow(VO1.last());
VO1.next();
VO1.insertRow(row1);
row1.setNewRowState((byte)-1);
row1.setNewRowState((byte)-1);

Now run the page and see the output.


Now click on add button.

The new row has been created.


35. Export data from OAF to Excel programmatically

Exporting data from OAF page to Excel programmatically


Now we are going to learn about how to export the data of VO from OAF page to excel sheet.

Consider there is a table region which retrieves a data from a VO. Now we have to export
that data to excel sheet.

Create a submit button in the table region.

Write the following code in the Controller ProcessFormRequest

/*
****************************************
* Call the export button
****************************************
*/
if(pageContext.getParameter("Export") != null)
{
/* Specify the hidden attribute column names*/
String ss[] = { null };
/* Call the method to export data */
downloadCsvFile(pageContext, "AOPErrorMsgVO1", null, "MAX", ss);
}
/* End of calling the export button */

/*
*************************************
* Create method to export the data
*************************************
*/

public void downloadCsvFile(OAPageContext pageContext, String view_inst_name,


String file_name_without_ext, String max_size, String hidden_attrib_list[])
{
/*
***********************************
* Specify all Column names
**********************************
*/

String voFieldNames[] = {
"Error Message","Item/Level1", "BillToCust/Level2", "ODM/Level3", "OEM/Level4",
"MarketSegment/Level5", "Program Name/Level6", "Organization/Level7","Time
Period","Fiscal Year", "Total Units", "Total Sales"
};
/* End of column names */
OAViewObject v =
(OAViewObject)pageContext.getRootApplicationModule().findViewObject(view_inst_name
);
if(v == null)
{
throw new OAException("Could not find View object instance "+view_inst_name+"
in root AM.");
}
if(v.getFetchedRowCount() == 0)
{
throw new OAException("There is no data to export.");
}
String file_name = "AOP_Error_Report";
if(file_name_without_ext != null && !"".equals(file_name_without_ext))
{
file_name = file_name_without_ext;
}
HttpServletResponse response =
(HttpServletResponse)pageContext.getRenderingContext().getServletResponse();
response.setContentType("application/text");
response.setHeader("Content-Disposition", "attachment; filename="+file_name+".csv");
ServletOutputStream pw = null;
try
{
pw = response.getOutputStream();
int j = 0;
int k = 0;
boolean bb = true;
System.out.println("inside try block");
if(max_size == null || "".equals(max_size))
{
k = Integer.parseInt(pageContext.getProfile("VO_MAX_FETCH_SIZE"));
bb = false;
} else
if("MAX".equals(max_size))
{
bb = true;
} else
{
k = Integer.parseInt(max_size);
bb = false;
}
AttributeDef a[] = v.getAttributeDefs();
StringBuffer cc = new StringBuffer();
ArrayList exist_list = new ArrayList();
for(int l = 0; l < a.length; l++)
{
boolean zx = true;
if(hidden_attrib_list != null)
{
for(int z = 0; z < hidden_attrib_list.length; z++)
{
if(a[l].getName().equals(hidden_attrib_list[z]))
{
zx = false;
exist_list.add(String.valueOf(a[l].getIndex()));
}
}

}
}

for(int l = 0; l < voFieldNames.length; l++)


{
boolean zx = true;
if(zx)
{
cc.append("\""+voFieldNames[l])+"\"");
cc.append(",");
}
}

String header_row = cc.toString();


pw.println(header_row);
OAViewRowImpl row = (OAViewRowImpl)v.first();
do
{
if(row == null)
{
break;
}
j++;
StringBuffer b = new StringBuffer();
for(int i = 0; i < v.getAttributeCount(); i++)
{
boolean cv = true;
for(int u = 0; u < exist_list.size(); u++)
{
if(String.valueOf(i).equals(exist_list.get(u).toString()))
{
cv = false;
}
}

if(cv)
{
Object o = row.getAttribute(i);
if(o != null)
{
if(o.getClass().equals(Class.forName("oracle.jbo.domain.Date")))
{
Date dt = (Date)o;
java.sql.Date ts = dt.dateValue();
SimpleDateFormat displayDateFormat = new SimpleDateFormat("dd-
MMM-yyyy");
String convertedDateString = displayDateFormat.format(ts);
b.append("\"" + convertedDateString + "\"");
} else
{
b.append("\"" + o.toString() + "\"");
}
} else
{
b.append("\"\"");
}
b.append(",");
}
}

String final_row = b.toString();


pw.println(final_row);
if(!bb && j == k)
{
break;
}
row = (OAViewRowImpl)v.next();
} while(true);
}
catch(Exception e)
{
e.printStackTrace();
throw new OAException("Unexpected Exception occurred.Exception
Details :"+e.toString());
}
pageContext.setDocumentRendered(false);
try
{
pw.flush();
pw.close();
}
catch(IOException ioexception)
{
ioexception.printStackTrace();
throw new OAException("Unexpected Exception occurred.Exception Details :"
ioexception.toString());
}
try
{
pw.flush();
pw.close();
}
catch(IOException e)
{
e.printStackTrace();
throw new OAException("Unexpected Exception occurred.Exception Details
:"e.toString());
}
}/*End of Export method*/
36. Reusable Codes in OAF

Reusable Codes For OAF

 By default setting some value for field on page load write the following code
in processRequist

//Capturing the item in the page.


OAMessageTextInputBean name
=(OAMessageTextInputBean)webBean.findChildRecursive("FullName");

// “FullName” id of the field

name.setText("SANGU"); //Set the required value to that field.

 To get the value of a field write the following code

OAMessageTextInputBean msc =
(OAMessageTextInputBean)webBean.findChildRecursive("EmployeeName");

msc = msc.getValue(pageContext).toString();

 To hide some field write the following code in processRequist

OAMessageTextInputBean manager
=
(OAMessageTextInputBean)webBean.findChildRecursive("ManagerId");

manager.setRendered(false);

 To clear the fields


if(pageContext.getParameter("Clear")!=null)
{

OAMessageTextInputBean mstb

= (OAMessageTextInputBean)webBean.findChildRecursive("item1");

mstb.setValue(pageContext,null);

OAMessageTextInputBean mstb1
=(OAMessageTextInputBean)webBean.findChildRecursive("item2");

mstb1.setValue(pageContext,null);

 To clear the Page

if (pageContext.getParameter("Clear")!=null) //Clear is the id of the clear button

pageContext.forwardImmediatelyToCurrentPage(null,false,null);

 For message choice item to display LOV set the following in item property

DATA--->

Picklist View Instance:-Give the vo name(HelloWordVO)

Picklist Display Attribute:Which column should display(Deptno)

Picklist Value Attribute:-Which column values should display(Deptno)

BC4J--->

View Instance:-select the view instance name(HelloWordVO1)


View Attribute:-Select the column (Deptno)

 Passing Control from one page to another page

if(pageContext.getParameter("item8")!=null)
{

pageContext.setForwardURL("OA.jsp?page=/ascon/oracle/apps/po/MyprojectPRJ/webui/E
mplo yeedetailsPG",

null,

OAWebBeanConstants.KEEP_MENU_CONTEXT,

null,

null,

true,

OAWebBeanConstants.ADD_BREAD_CRUMB_YES,

OAWebBeanConstants.IGNORE_MESSAGES);

 Calling the D2K Form from OAF

if(pageContext.getParameter("submit")!=null) //give the id of the submit button.


{

//form:APPLICATION_SHORT_NAME:RESPONSIBILITY_KEY:DATA_GROUP_NAME

//:FORM_FUNCTION_NAME

String destination =

"form:SYSADMIN:SYSTEM_ADMINISTRATOR:STANDARD:FND_FNDSCAUS";

pageContext.forwardImmediatelyToForm(destination);

}
 For single select in radio button write the following code in processRequest of the
controller

OAMessageRadioButtonBean var1
= (OAMessageRadioButtonBean)webBean.findChildRecursive("Male");

var1.setName("Gender"); //Cerate’s the group for the radio buttons

var1.setValue("Male");

OAMessageRadioButtonBean var2

= (OAMessageRadioButtonBean)webBean.findChildRecursive("Female");

var2.setName("Gender");

var2.setValue("Female");

 While registering our project to the server we have to import the files (xml import)

C:\dev\oaf\r1211\jdevbin\oaext\bin

import
C:\dev\oaf\r1211\jdevhome\jdev\myprojects\ascon\oracle\apps\po\MasterDetailPRJ\w
ebui \MasterDetailPG.xml -rootdir C:\dev\oaf\r1211\jdevhome\jdev\myprojects -username
apps - password apps -dbconnection
"(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=focusthreadr12.com)(PORT=1521))(CO
NN ECT_DATA=(SID=visr12)))"

 While customization we have to import the java files.

jpximport C:\dev\oaf\r1211\jdevhome\jdev\myprojects\VOExtension.jpx -username apps - password


apps –dbconnection
"(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=focusthreadr12.com)(PORT=1521))(CONNECT_
DATA=(SID=visr12)))"

 For Bundled Exception

ArrayList exc=new ArrayList(); //first we have to initialize the ArrayList


Write the following code
write the following code inside the conditions for ex inside the save event.

if(eventName.equalsIgnoreCase("saveEvent"))

{ //This code will validate after we clicking on save.

if(empname.contains("@"))

exc.add(new OAException("Special character not allowed",OAException.ERROR));

if("".equalsIgnoreCase(pageContext.getParameter("StartDate").trim()))

exc.add(new OAException("Start date shold not be null",OAException.ERROR));

if(!exc.isEmpty())

OAException.raiseBundledOAException(exc);

 Creating Message in FrontEnd For Exception.

Switch to Functional Administrator Responsibility


Core Services--->messages-->Create message

Code:-

Application Name:-

Language:-

Text:- //Employee (&EMPNO) has been created successfully.

Apply it.
Goto jDeveloper write the following code

String eno=pageContext.getParameter("EmployeeId")

MessageToken [] token = new MessageToken ("EMPNO",+EmployeeId);

throw new OAException("Application Name","Code",token);

 TO Get The Sequence Value write the following in the create Attribute set in EO.

public void create(AttributeList attributeList)


{

super.create(attributeList);

OADBTransaction transaction = getOADBTransaction();

// DEFAULT: supplier id is obtained from the table's sequence

Number supplierId = transaction.getSequenceValue("FWK_TBX_SUPPLIERS_S");

setSupplierId(supplierId);

} // end create()
37. Import Commands in OAF

Import Commands in OAF

Import Command for page.

From unix server:

Run the below command from the path.

$JAVA_TOP/xx/oracle/apps/po/emp/webui

java oracle.jrad.tools.xml.importer.XMLImporter
$JAVA_TOP/xx/oracle/apps/po/emp/webui/EmployeePG.xml -rootdir $JAVA_TOP -
username apps -password apps -dbconnection
"(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=focusthreadr12.com)(PORT=15
21))(CONNECT_DATA=(SID= VISR12)))"

From command prompt:

C:\dev\oaf\r1211\jdevbin\oaext\bin

import
C:\dev\oaf\r1211\jdevhome\jdev\myprojects\xx\oracle\apps\po\emp\webui\EmployeePG.xml
-rootdir C:\dev\oaf\r1211\jdevhome\jdev\myprojects -username apps -password apps -
dbconnection
"(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=focusthreadr12.com)(PORT=15
21))(CONNECT_DATA=(SID=visr12)))"

Import Command for VO Extension.

Run the below command from the below path from command prompt.

C:\oaf\p9879989_R12_GENERIC\jdevbin\oaext\bin

jpximport C:\oaf\p9879989_R12_GENERIC\jdevhome\jdev\myprojects\VOExtension.jpx -
username apps -password apps –dbconnection
"(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=
focusthreadr12.com)(PORT=1521))(CONNECT_DATA=(SID= visr12)))"
38. How to create External Lov in OAF

Creating External Lov in OAF


Now we are going to learn about how to create the external lov in oaf.

Step1:- Create a Workspace and Project.

Step2:- Create an Application Module.

Step3:- Create a page and attach the application module.

Step4:- Now create a new VO for lov.

Name: - KPITextLovVO
Package: - sangu.oracle.apps.pos.lov.server (Its better practice to create all lov vo’s
under
lov.server)
Click on Next in the query section give the query for lov.
And click on generate the java files.

Step5:- Create one AM for lov


Name:- LovAM
Package:- sangu.oracle.apps.pos.lov.server

Step6:- Create a new region


Right click on project select new== > OAComponent == > Region.

Name :- KPITextLovRN
Package:- sangu.oracle.apps.pos.lov.webui

And set the below properties.

Scope :- public

And attach the LovAM to this region.

Step7:- Right click on the region and select new== > table using wizard.
Next select the LovAM under dropdown list and select the lov vo
Click next.
Select the column which u want for lov.
And finish.

Step8:- Now come to the main page under that create one item with style message lov input.
Set the below properties.
ExternalLov:- sangu.oracle.apps.pos.lov.webui.KPITextLovRN

Note:- Give the lov region u have created along with path.
Next Provide the lovmappings
LovRegionItem :- Name of the column
Return Item:- Id of the message lov input item.
Criteria Item :- Id of the message lov input item.

This finishes the external lov run the page to see the output.
39. VO Extension in OAF

VO Extension
Now we are going to learn about how to extend the view object in OAF.

Step1:- Navigate to the page where you want to extend the view object.
Analyze the page and note down in which region you want to extend.
Click on about this page and note down the VO associated with that region.
And also note down the path of the VO.

Step2:- Let us consider now we are extending the standard iProcurement page.

Now in My Requisition region in the existing table we are adding one more new column.
Note down the below details:-
VO Name:- MyReqsGlanceVO.
VO Path:- oracle.apps.icx.por.reqmgmt.server.MyReqsGlanceVO. (U will get the path of
the VO in Business components section ).

Step3:- Get the corresponding files from the server $JAVA_TOP to local machine.

Step4:- Convert the class file to java file.

Step5:- Open the jDeveloper.


Create the new workspace.
Create one project
Give the package name (VOExtension.oracle.apps.icx.por.reqmgmt.server)
Step6:- Right click on project select new
ADF Business Components
In that select View Object

Name:- (xxMyReqsGlanceVO)
Package:-Give the package name
(VOExtension.oracle.apps.icx.por.reqmgmt.server)
Extends:-Brows the standard VO
(oracle.apps.icx.por.reqmgmt.server.MyReqsGlanceVO)

Click on next

It will open the sql query window in that do the required changes according to the
requirement.
Don't forget to generate the java file
After creating the extended view object compile the java files.

Step7:- Goto the project right click select project properties

Business Components
Substitutions
In the substitution window select standard VO in left hand side and select custom VO on
right hand side and click on ADD button.
Step8:- Move that newly created folder back to the server
From C:\dev\oaf\r1211\jdevhome\jdev\myclasses
(the newly created VOExtension folder)
To /oracle/apps/r12/visr12/apps/apps_st/comn/java/classes

Step9:- JAVA import utility


Open the command prompt

change the directory to:- C:\oaf\p9879989_R12_GENERIC\jdevbin\oaext\bin

after that import the following:-

make the fallowing path in a single line for that in notepad go format uncheck word
wrap:-

jpximport
C:\oaf\p9879989_R12_GENERIC\jdevhome\jdev\myprojects\VOExtension.jpx -
username apps -password apps –dbconnection
"(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=
focusthreadr12.com)(PORT=1521))(CONNECT_DATA=(SID= visr12)))"
C:\dev\oaf\r1211\jdevhome\jdev\myprojects\VOExtension.jpx this the path where
your jpx file located in your machine.

Step10:- To check the extension has done or not go to the sql developer execute the
following command

begin
jdr_utils.listCustomizations('/oracle/apps/icx/por/reqmgmt/server/MyReqsGlanceVO');
end;

It will give the path.

Step11:- Bounce the Apache Web Server.

Step12:- Go to the front end go to the page which u want to extend.


Click on about this page. Expand all in business components check whether the extended VO
is reflecting or not.

Step13:- Do some personalization

Add a new item of column type for the newly added filed.

Add a new item for displaying the information.


provide the required info

View attribute of the new field


View Instance (Give the standard View Instance name)

Create one item for column header.

That finishes the view object extension.

Go back to the page and check the newly added field is appearing or not.
40. Calling KFF in OAF

Key Flex Field(KFF) in OAF

Now we are going to learn about how to call the KFF in OAF.

The below query will give the required information about flex field.

SELECT fif.application_id,
fif.id_flex_code,
fif.id_flex_name,
fif.application_table_name,
fif.description,
fifs.id_flex_num,
fifs.id_flex_structure_code,
fifse.segment_name,
fifse.segment_num,
fifse.flex_value_set_id
FROM fnd_id_flexs fif,
fnd_id_flex_structures fifs,
fnd_id_flex_segments fifse
WHERE fif.application_id = fifs.application_id
AND fif.id_flex_code = fifs.id_flex_code
AND fifse.application_id = fif.application_id
AND fifse.id_flex_code = fif.id_flex_code
AND fifse.id_flex_num = fifs.id_flex_num
AND fif.id_flex_code LIKE 'GL#'
AND fif.id_flex_name LIKE 'Accounting Flexfield';

Step1: - Create a work space and project with the package


sangu.oracle.apps.po.KFFPrj

Step2: - Create an Application Module.

Name: - KFFAM
Package: - sangu.oracle.apps.po.KFFPrj.server

Step3:- Create a view object.

Name: - KFFVO
Package: - sangu.oracle.apps.po.KFFPrj.server
Query: - SELECT code_combination_id
FROM gl_code_combinations_kfv

Note: - Generate the java files.

Step4: - Attach the VO to AM.


Step5: - Create new page.

Name: - KFFPG
Package: - sangu.oracle.apps.po.KFFPrj.webui

Step6:- Attach the AM to the Page Layout Region of a page.


Give the window title and title.

Step7: - Create new Stack Layout Region Under Page Layout Region

Step8: - Create new item of type Flex under Stack Layout Region.
And set the below properties.

ID: - KffItem
Prompt: - KFF
View Instance: - KFFVO1
Application Short Name: - SQLGL
Name: - GL#
Type: - Key

Step9:- Create a controller for the page.


Right click on pageLayout region== > set new controller.

Name: - KFFCO
Package: - sangu.oracle.apps.po.KFFPrj.webui
Step10: - Write Following Code in KFFCO processRequest
/* For Copy Paste */

public void processRequest(OAPageContext pageContext, OAWebBean webBean)


{
super.processRequest(pageContext, webBean);

OAKeyFlexBean kffBean =
(OAKeyFlexBean)webBean.findIndexedChildRecursive("KffItem");

if(kffBean != null)
{
// Set the code combination lov
kffBean.useCodeCombinationLOV(true);
//set the structure code for the item key flex
kffBean.setStructureCode("FED_AFF");
//Set the attribute name to the item
kffBean.setCCIDAttributeName("CodeCombinationId");
//Execute the Query
KFFAMImpl am = (KFFAMImpl)pageContext.getApplicationModule(webBean);
KFFVOImpl vo = (KFFVOImpl)am.findViewObject("KFFVO1");

if(!vo.isPreparedForExecution())
{
vo.executeQuery();
}
}
}

Step11:- This finishes the calling kff in OAF run the page to see the output.
41. How to get the value of the field in OAF

How to get the value of the field in OAF


Now we are going to learn about how to get the value of a field in OAF.
Let us assume there is a messagetextinput field now we have to capture the value entered in
that field.

Import the OAMessageTextInputBean

import oracle.apps.fnd.framework.webui.beans.message.OAMessageTextInputBean;

OAMessageTextInputBean msc =
(OAMessageTextInputBean)webBean.findChildRecursive("EmployeeName");
msc = msc.getValue(pageContext).toString();
42. 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

}
43. 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

}
44. 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.
45. How to remove personalization in OAF

How to remove personalization in OAF


Now we are goin to learn how to remove the personalization in OAF.

Step1:- Login to oracle application.


Step2:- Switch to Functional Administrator responsibility.
Step3:- Click on personalization tab.
Step4:- For application, Enter the respective application name.
Step5:- Click on the Personalized Checkbox.
Step6:- Click Go.
Step7:- Remove or De-activate your personalization by selecting the personalization level at
which you made a particular personalization.

OR

Step1:- Login to oracle application.


Step2:- Switch to Functional Administrator responsibility.
Step3:- Click on personalization tab.
Step4:- Click on import/export sub tab menu.
Step5:- For application, Enter the respective application name.
Step6:- Provide the document path.
To get the path
Go to sql developer run the following it will give the path.

begin

jdr_utils.listCustomizations('/oracle/apps/icx/por/reqmgmt/server/MyReqsGlanceVO');
//Give the page path on which u did personalization or if u did extension provide
on which u extended.

end;

Step7:- Click on Go.

Step8:- select the personalization and delete it.


Error while deploying the OAF page in R12.2.4

Error while deploying the OAF page in R12.2.4

When I am migrating the objects from R12.1.3 to R12.2.4 I am facing the below error.

Exception Details.
oracle.apps.fnd.framework.OAException: Could not load application module
'xxmsc.oracle.apps.wsm.TLS.server.AssemblyLotAM'.

The solution for this is, we need to follow below steps. In R12.2.4 the weblogic server was
introduced. We need to create the custom jar files and it must be made available for
WebLogic to pick it up.

Steps
=====

Go to the custom path where class file is present

adcgnjar

Bounce the oacore

cd $ADMIN_SCRIPTS_HOME

./admanagedsrvctl.sh stop oacore_server1

./admanagedsrvctl.sh start oacore_server1

Bounce the apache

./adapcctl.sh stop

./adapcctl.sh start

Link: http://yesyespatil.blogspot.in/

You might also like