Вы находитесь на странице: 1из 239

Oracle Application Framework (OAF) Training Manual OAF

Chapter 1: Introduction ................................................................................................................ 1


Difference Between OAF and Oracle Forms .......................................................................... 1
Structure of OAF ........................................................................................................................ 2
Onion Structure of OAF ............................................................................................................ 4

Chapter 2: MVC Architecture ..................................................................................................... 5


Advantages & Disadvantages of OAF .................................................................................... 5
About Model ............................................................................................................................... 6
Entity Objects and Entity Association ..................................................................................... 7
View Objects and View Links ................................................................................................... 8
Application Module ................................................................................................................... 9
About View ............................................................................................................................... 12
BC4J File Structure ................................................................................................................... 13

Chapter 3: JDeveloper Configuration ..................................................................................... 14


Installation Process of JDeveloper ......................................................................................... 21
JDeveloper Configuration Steps ............................................................................................. 23

Chapter 4: Creating First Page .................................................................................................. 38


Displaying Images on Page..................................................................................................... 55
Creating Items and Regions In a Page .................................................................................. 61
How to display User Name, User Id and Responsibility in OAF ..................................... 70

Chapter 5: Regions In JDeveloper ........................................................................................... 80


Header Region .......................................................................................................................... 83
Row Layout Region.................................................................................................................. 88
Default Double Column .......................................................................................................... 90
Default Single Column ............................................................................................................ 94
Page Button Bar ........................................................................................................................ 97
Query Region .......................................................................................................................... 101

Chapter 6: Items In JDeveloper .............................................................................................. 102


Message Text Input ................................................................................................................ 102
Message Styled Text ............................................................................................................... 104
Message Check Box ................................................................................................................ 105
Message Radio Button ........................................................................................................... 107
Message Choice ...................................................................................................................... 110
Submit Button ......................................................................................................................... 119
Message Rich Text Editor ...................................................................................................... 121
Image Item ............................................................................................................................... 122

Chapter 7: Sample Exercises ................................................................................................... 124


Displaying Exception Messages Based on Condition ....................................................... 124
Swapping The Value From One Field to Another Field ................................................... 127
Oracle Application Framework Training Manul OAF

Displaying Data From Data Base ......................................................................................... 129


Data Entry Page in OAF ........................................................................................................ 137
Calling One Form to Another Form .................................................................................... 153
SPEL In OAF ........................................................................................................................... 157

Chapter 8: Search Pages In OAF............................................................................................. 164


Search Pages in OAF .............................................................................................................. 164
Automatic Search Inline LOV............................................................................................... 164
Automatic Search External LOV .......................................................................................... 169
Result Base Search .................................................................................................................. 180
Manual Search ........................................................................................................................ 185

Chapter 9: Sample Project Work ............................................................................................ 191


MD-50 of Sample Project in OAF ......................................................................................... 191
Creating First OAF Page In Project ...................................................................................... 193
Creating Search Page ............................................................................................................. 199
Creating Update Page ............................................................................................................ 205
Calling OAF Pages Using Update and Detail Images ...................................................... 209
Final Code in AM, Update Page, and Patient Entry Page Controller............................. 213
Dynamic Changes in OAF pages ......................................................................................... 219

Chapter 10: Deploying OAF Pages Into Oracle Apps ........................................................ 225
Moving OAF Project Files Into Apps Server ...................................................................... 225
Import Script in OAF ............................................................................................................. 228
Creating Function,Menu, and Responsibility in Apps for OAF Pages .......................... 229
Oracle Application Framework (OAF) Training Manual OAF

Chapter 1: Introduction
What is OAF

 Oracle Application Framework (OA Framework or OAF) is a framework developed by Oracle Corporation for
application development within the Oracle E-Business Suite (EBS)
 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.
 The OA Framework helps to create self Service pages in Oracle EBS.
 The OA Framework helps in controlling the flow of the application.
 OA Framework works on the basic Java EE principles.
 To Learn OAF you must know the Basics of Java like Core Java.
 User Interface is Very Interactive in OAF
 OA Framework contains inbuilt security
 We can view OA Framework pages in mobile phones too which contains Internet browsing feature
 OA Framework is J2EE based but it also supports various standards like HTML, XML, SQL, JSP.

Necessary to use OAF In Oracle Apps:

The necessary to use OAF in Oracle applications is Integration, Security, and Customization.

Integration: Registration of Forms is easy.

Security: Flexibility reasons if we are using third party we don’t know when it is going to fail.

Customization: If we are integrating with third party customization is tough whereas using OAF customization
is little bit easier when comparing to Other Third party customizations.

Difference Between OAF and Oracle Forms

Let us discuss some difference in OAF pages and Oracle Forms. The below table lists out the differences
between OAD and Oracle Forms.

OAF Oracle FORMS

OAF Follows MVC architecture and Client ServerArchitecture Forms Follows only Client Server Architecture

OAF pages are light weight components Forms are not light weight
Oracle Application Framework Training Manul OAF

OAF Pages can send through mobile devices Cannot send to mobile devices

OAF Pages can connect in Oracle Apps Local Machine Cannot (NOT APPLICABLE)

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

Commit always takes place in the Application Module’s (AM) The COMMIT_FORM or DO_KEY(‘COMMIT_FORM’) comm
Java code. When a commit takes place, the data from OA can be invoked from any trigger that allows restricted
Framework Cache is transferred to the database. procedures.

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

Structure of OAF

Let us discuss about the structure of OAF.

OAF follows J2EE Architecture and J2EE follows MVC architecture so therefore ultimately OAF follows MVC
Architecture.

The abbreviation of MVC is Model View Controller.

MVC is the clean design interface between Model, View, and Controller.
Oracle Application Framework Training Manul OAF

Model will take care the Data Base related Transactions, Model contains the following:

 Entity Object (EO)


 View Object (VO)
 Callable Statement (PL/SQL Statement)
 Prepare Statement (Single Select Statement)
 OADB Transactions (Oracle Apps Data Base Transactions)

View is nothing but the OAF Page Output. View is implemented by UIX (User Interface XML).

Controller will take care of web browser activities like HTTP Get and HTTP Post
Controller have got three methods:

 Process Request
 Process Forms Request (HTTP Get)
 Process Form Data (HTTP Post)
HTTP get: While loading the Page we use HTTP Get.

HTTP Post : After Loading the page if we want any changes the we use HTTP Post.

We will discuss in detail about MVC architecture in the next chapters.


Oracle Application Framework Training Manul OAF

The Below figure shows the interaction between Model, View, and Controller.

Onion Structure of OAF

 Another structure of OAF is called Onion structure.


 The OA Framework can be extracted into a series of concentric layers.
 Each layer knows only about the layers below to them.
 The below figure shows the Onion Structure, in which AM interacts with the VO and VO interacts with EO and
finally EO interacts with Data Base.
Oracle Application Framework Training Manul OAF

Chapter 2: MVC Architecture


Advantages & Disadvantages of OAF
The advantages of OAF are as follows:

1) End user Productivity

2) Enterprise Grade Performance and Scalability

3) Highly extensible Architecture

4) Browser Look and Feel of all the pages in application.

5) Open Standards such as XML, HTML, Java, JSP, SQL, and Web Services.

6) Application Customizability.

7) Developer Productivity.

The disadvantages of OAF are:

i) Cannot see the layout at design time.

ii) OAF Pages are integrated / compatible only with the Oracle Apps.

iii) Drag and Drop options are not available.


Oracle Application Framework Training Manul OAF

iv) More R&D is required to design a form layout which is time consuming.

About Model

The entire Database related transactions in OAF pages will be taken care by the MODEL.
 Model is where the application implements business logic.
 Model will implement all the Data Base transactions.
 Model component is implemented using BC4J where BC4J is Business Component for Java.
 BC4J consists of three components:
 Entity Object and Entity Associations
 View Objects and View Links
 Application Module
Model contains six components including BC4J components, additionally the other three components are:

 Callable Statement
 Prepare Statement
 OADB Transactions
Callable statement is used to call a PL/SQL statements, Prepare statements are used if we are using single
SELECT statement, and OADB transactions will take care of Oracle APPS related Data Base transactions.
Oracle Application Framework Training Manul OAF

Entity Objects and Entity Association

Entity Objects
 The entity objects are used if one wishes to do some insert/update operations.
 Entity Objects represents a Data Base Row of a table.
 Entity Objects will be based on the View (Oracle View), Synonyms or snapshots.
 We need to create Entity Object if we want to perform DML operations on the OAF Page.
 All the Entity Objects end with the EO.

Example: employeeEO

 When we create Entity Object (EO) one subclass will generate.

We have two types of Entity Objects

I. PL/SQL based Entity Objects

II. Java based Entity Objects

Note that we have two types of tables in Oracle Apps they are Custom Tables and Seeded Tables.

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

Entity Association
 Entity Association is the relationship between two Entity Objects having one common column.
 All the Entity Association ends with the AO (Association Object).
Example: EmpDeptAO
 If we want to perform DML operations on Master Detail page then we go for Entity Association.
 If we want to common know column between two tables then we will go for Entity Association.
Oracle Application Framework Training Manul OAF

View Objects and View Links

View Objects
 View Objects are used where we want some data to be displayed on page.
 View Objects are used just for displaying purpose.
 View Objects access the result set of a SQL statement, it can be either based on the Entity Object or plain SQL
query.
 All the view objects ends with the VO
Example: employeeVO

 When we create the View Object (VO) one subclass will generate with setters and getters method.

We have four types of View Objects and they are:

1) Manual VO

2) Automatic VO

3) Validation VO

4) Property VO

Manual VO: If we are writing our own SQL query then it will be called as Manual VO.

Automatic VO: Automatic VO is when we select an Entity Object automatically it will select the Query.

Difference between Manual and Automatic VO is:


Oracle Application Framework Training Manul OAF

 If we want to perform DML operations then we can go for VO that should be based on Entity Object.
 We go for Manual VO if we are using simple SELECT statement.

NOTE: Note that when we create VO (View Object) all the table columns will be converted into attributes,
hence here we call columns as attributes.

Validation VO:Validating the data in the Data Base, example using WHERE condition in the SELECT statement.
Property VO:Attributes / columns without Data Base columns comes under property VO. These attributes are
also called as Transient attributes.

Example: Suppose there is a table which holds student marks so therefore it contains 6 columns to hold six
subject marks for each student. There is no total column in the table to store the total marks of the student
separately. Now in the output for display purpose we are taking TOTAL attribute hence which is not from Data
Base table and this TOTAL attribute is called Transient attribute.

View Links
Relationship between two View Objects having one common column in both the VO’s is called View Link. All the
View Link objects end with the VL

Example: DeptEmpVL

Note that if we want to display Master Detail data then we go for View Links, where as if we want to perform
DML operations on Master Detail data we go for Entity Association.

The below figure shows that how View Objects and View Links are interacting with Data Base, VO interacts with
Data Base Directly or VO interacts with Data Base through the EO.

Application Module
 It is very important component in the Model.
 Every Oracle Application Framework (OAF) page should be attached to some Application Module.
 It is the interface between the Client transactions and Data Base transactions.
 All the application module objects end with AM.
Example: employeeAM

 Whenever we create AM one subclass will generate.


Oracle Application Framework Training Manul OAF

Application Module is of two types and they are:

I. Root Application Module.

II. Nested Application Module.

If we are attaching AM to the Main Region of the page then it is called Root Application Module and if we are
attaching to the child regions (or) nested regions then it is called Nested Application Module.

The below figure shows what is Main region and what are child regions in OAF page.
Oracle Application Framework Training Manul OAF

The View Objects containing in the Main Application Module can be used anywhere in the child regions or
Nested Application Module.

If the View Objects are attached to the Nested Application Module then those view objects are applicable only
to that particular nested region.
Oracle Application Framework Training Manul OAF

About View

 View is the actual output OAF page what an end user can able to see.

 In Oracle Apps Framework View is implemented using UIX technology, whereas UIX means User Interface XML.

 Whenever we run the page in JDeveloper then automatically UIX will generate web.xml file.

 The power of UIX is that allows metadata to be translated to an HTML page for a web browser or mobile device
browsers.

 The generated web.xml file will be converted into HTML format of OAF page.

 Since web.xml file here will work as a cache memory.

 Whenever we want to move the web.xml file into the server side then MDS repository is used to move the
web.xml file into the server.

 MDS stands for Meta Data Service and in the application top we will be having MDS folder.
Oracle Application Framework Training Manul OAF

 When we deploy all the OAF page destination paths, regions then the files will be stored into the MDS tables.

 The MDS table are like:

JDR_Paths:Stores the path of the documents, OA Framework pages and their parent child relationship.
JDR_Components:Stores components on documents and OA Framework pages.
JDR_Attributes:Stores attributes of components on documents and OA Framework pages.
JDR_ATTRIBUTES_TRANS:Stores translated attribute values of document components or OA framework
pages.
JDR_DOCUMENT_ID_S: This is a sequence generator table.

 MDS can be managed using standard database procedures and tools.

BC4J File Structure

BC4J stands for Business Component for Java, the following figure shows the file structure of Business
Component for Java where xxname stands for any used defined name and POis the responsibility name
Purchasing, Vision Operations (USA)of the Oracle Applications and we can use other also depending upon the
requirement. In place of XXAAM we generally use client name.

In the below figure we got

 BC4J of AM and VO
 BC4J of EO
 BC4J of LOV
 BC4J of poplist
 BC4J of Controller
 BC4J of Page
Oracle Application Framework Training Manul OAF

Chapter 3: JDeveloper Configuration


Identifying JDdeveloper Version

Let us see how to identify the JDeveloper for the Oracle Apps Instance Version.
Oracle Application Framework Training Manul OAF

Step 1: If we observe we will find an option called “About this Page” in OAF Page. Click on the link About this
Page. The same process is shown in the below figure:

Sometimes you may not find an option called About this Page, for that you need to set one Profile Option in
Oracle Apps. The name of the profile option is “Personalize Self-Service Defn”. Switch to the responsibility,
System Administrator.

The navigation to select the profile option is:

System Administrator -> Profile -> System

The same navigation is shown in the below figure:


Oracle Application Framework Training Manul OAF

After that select the Display level as Site and down in the Profile give name like “Persolalize%Self%”, the same
scenario is shown in the below figure:
Oracle Application Framework Training Manul OAF

After entering, click on Find button then you can see full profile option name. At site level select YES option to
activate About this Page link in the Oracle apps Framework page. The same scenario is shown in the below
figure:
Oracle Application Framework Training Manul OAF

Step 2: After selecting About This page we can see another window, in that select a tab called “Technology
Components” and after selecting that tab we can see the option called OA Framework which shows the
version name of OA Framework. The same scenario is shown in the below figure which is showing the version
number as 12.1.3.
Oracle Application Framework Training Manul OAF

Step 3: Now you need to download the JDeveloper patch of the version which we identified in Technology
Components. All the patches we can download from Oracle Meta link, and the file size is 500+ MB. The below
table lists some patches related to the versions:

Oracle Apps Release Version JDeveloper Patch

12.1.0 Patch 7315332

12.1.1 Patch 8431482

12.1.2 Patch 9172975


Oracle Application Framework Training Manul OAF

12.1.3 Patch 9879989

The below picture shows the patch of the version 12.1.3:-

Extract the ZIP file and open the patch folder you will find three folders, as shown in the below figure contains
jdevbin, jdevdoc, jdevhome:
Oracle Application Framework Training Manul OAF

Installation Process of JDeveloper


Let us see the installation process of JDeveloper, after opening the un zipped file you will find three folder
called jdevbin, jdevhome, jdevdoc, the below figure shows the same scenario:

In the next step open jdevbin folder in that you will find a jdev folder again open jdev folder the you can see
bin folder, after that if you observe we can find jdev and jdevW icons. The jdev is for UNIX environment and
jdevW is for Windows environment. The same scenario is shown in the below figure stepwise:
Oracle Application Framework Training Manul OAF

Now send a shortcut of jdevW to desktop .

The below figure shows the same scenario, have a look into it:
Oracle Application Framework Training Manul OAF

Now you can see the shortcut of JDeveloper directly on Desktop.

JDeveloper Configuration Steps


Oracle Application Framework Training Manul OAF

Let us discuss how to configure JDeveloper in our system, we are here discussing in Windows environment step
wise.

Step 1: First step is we need to set the Jdev environment variables for windows. Go to environment variable in
windows properties. Right Click on Computer/My Computer select properties. The same scenario is shown in
the below figure.

Select Advanced System Settings after choosing the Properties of Computer, the same scenario is shown in
the below figure:
Oracle Application Framework Training Manul OAF

Now in the top User Variables select New Button for adding a New User variable as show in the below figure:
Oracle Application Framework Training Manul OAF

Note that you must give Variable name as “JDEV_USER_HOME” and Variable Value is the path of the
jdevhome\jdev. Let us consider as a example I downloaded the patch and extracted it to Bharath\Softwares in
D: drive now my path for Variable value is:
D:\Bharath\Softwares\p9879989_R12_GENERIC\jdevhome\jdev

The same thing is shown in the below figure:


Oracle Application Framework Training Manul OAF

Step 2: After setting Variable name and Variable value we need to select DBC file into from Oracle Apps fnd
top, copy DBC file and paste it in JDeveloper patch.
To know where exactly the DBC file is located in Oracle Apps go to About this Page and select Java System
Properties tab then in the list we can find an System Property called DBC FILE, in the Value behind to DBC FILE
is the path where exactly the DBC file located in the Oracle Apps.

The same scenario is shown in the below figure:


Oracle Application Framework Training Manul OAF

Step 3: After finding where exactly the DBC file located go to that particular path and copy the DBC file (note
that don’t delete the dbc file and also don’t cut it).
Here we are using WinScp which connects to the server from our desktop system, we can also use putty to
connect to the server or any other tool which works similar like WinScp or Putty connection manager.

Install WinScp and the following figure shows the icon how it look like:

While giving path name directly don’t give /naora1.dbc, according to the above figure give the path as

/u01/apps1/inst/apps/naora1_naapps/appl/fnd/12.0.0/secure

After giving path you will find DBC file just copy it, the same scenario is shown in the below figure:
Oracle Application Framework Training Manul OAF

After copying in your desktop system go to the jdevhome folder , then jdev, next dbc_files, and then next
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.

The following figures shows the same scenario:

Step 4: After pasting 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. The below figure shows how the opening page looks like:
Oracle Application Framework Training Manul OAF

Step 5: Create a data base connection, go to Connections tab after that Right Click on Data Base folder and
then select New Database Connection…, the same scenario is shown in the below figure:
Oracle Application Framework Training Manul OAF

After selecting New Database Connection… Welcome to the create Data Base connection window opens simply
click on Next button. After that give the Connection Name here in the below figure if we observe the connection
name is NewtonApples, and the Connection Type must be Oracle (JDBC)
Oracle Application Framework Training Manul OAF

Click on next button after giving Connection Name, in the next window it asks for username and password give
Toad/Oracle SQL Developer tool connection name. The same scenario is shown in the below figure:-
Oracle Application Framework Training Manul OAF

After giving Username and Password click on the Next button, now you need to give connection details all the
connection details we even can find in DBC file, to check those detail open the DBC file with notepad there you
can find Host Name , JDBC Port, and Service Name. Give appropriate names and note that Driver type is thin.
Oracle Application Framework Training Manul OAF

Now after giving proper names click on the Next button we can find Test Connection button click on the Test
Connection button to check the connection is success or not.
Oracle Application Framework Training Manul OAF

Click Next button and then click Finish button.

Step 6: This is the last step in JDeveloper configuration, set the JDeveloper default Project Properties. Go to
Tools à Default Project Properties. The same scenario is shown in the below figure:
Oracle Application Framework Training Manul OAF

After selecting Default Project Properties… from Tools menu, in the highlighted Project Properties extract Oracle
Applications and select Run time Connection.

The same scenario is shown in the below figure:


Oracle Application Framework Training Manul OAF

Now give the following details:

DBC File Name: Give the path where exactly the DBC File is stored which actually we copied from server to
our desktop system.
User Name: The user name is Oracle Apps instance User Name
Password: Password is Oracle Apps instance Password.
Application Short Name: Any application short name which user got access permit and also note that
whatever the application short name we are giving it must contain at least one OAF page and also that must be
attached to the responsibility of the User Name which we are giving.
Responsibility Key: Responsibility key of the Application Short Name.

The below figure shows the example showing DBC file path, User Name, Password, Application Short Name,
Responsibility Key. Just have a look into the picture.
Oracle Application Framework Training Manul OAF

Finally click on OK button, so that we finished our JDeveloper Configuration process.

Chapter 4: Creating First Page


Welcome (or) Sample Page Creation

Let us start OAF work with creation of First Sample Page.

To Create a page in Oracle Apps Framework (OAF) we need to follow six steps listed as:

i) Create .JWS ( Java Work Space )

ii) Create .JPR ( Java Project )

iii) Create BC4J for AM ( Application Module )


Oracle Application Framework Training Manul OAF

iv) Create AM ( Application Module ) in respective BC4J.

v) Create the page and attach to AM

vi) Give Window Title and Title name to the page.

Note that for R12 version no need to create BC4J separately it will be created automatically by JDeveloper. Let
us develop our first page step wise.

Step 1: Open JDeveloper, after opening we will find Application Navigator if not then select it from View -
> Application Navigator ( ctrl + shift + A ). Right click on Applications and then select New OA Workspace…,
the same scenario is shown in the below figure:

Now give the File Name for Java Work Space, for example “Welcome” as shown in the below figure:
Oracle Application Framework Training Manul OAF

After giving File Name click on the OK button. After clicking on OK button button we can see Welcome window
to Oracle Applications Project Wizard.

Click on Next button, then we can see a window which asks for Project Name, give the project name for
example “Welcome PRJ”, Give the Default Package, for example
“newtonapples.oracle.apps.po.welcomeprj.webui”.
Oracle Application Framework Training Manul OAF

Click on Next > button, again click on Next > button then we can see. In Step 3 of 3 of Oracle Applications
Project Wizard we can see Connection details and Responsibility details which we added early in JDeveloper
Configuration Steps.
Click Next > and then Finish.
Step 2: After creating WorkSpace and Project we can see the +Welcome Project structure below to
Applications. Extract project (Welcome) and WorkSpace then we will find three folders namely
1. Application Sources

2. Resources

3. Web Content

Now, Create New Application Mudule…by giving Right click on Resources you can select an option called New
Application Mudule…
The same scenario is shown in the picture format:
Oracle Application Framework Training Manul OAF
Oracle Application Framework Training Manul OAF

Click on Next so that we will see Create Application Module as shown below. In the below figure observe that
we not yet changed the package name and also not specified the name for Application Mudule. Extends we can
see in extensions chapters.
Oracle Application Framework Training Manul OAF

If we observe in the above figure we not yet changed the package name for Application Mudule (AM). To see
the package structure we can see in the chapter BC4J file structure. So now we need to change the package
name from “webui toserver” and give name for the Application Module.
For example:
Oracle Application Framework Training Manul OAF

Click on Next > Button we will see Create Application Module – Step 2 of 4 window no need to do any changes
here keep as it is and click on Next > Button again.
Oracle Application Framework Training Manul OAF

After clicking on Next button we will see Create Application Module – Step 3 of 4 window here to no need to do
any changes simply again click on Next > button to move to another step.
Oracle Application Framework Training Manul OAF

After clicking on Next button without any changes we can see the below window and make sure that
Application Mudule Class:<nameof AM+impl> Generate Java File(s) check box must be checked. By default it is
checked if not just click on the box to Check.

Click on Next > button again or even we can click on Finish button here.

Click on Finish button so that our Application Module will be created.


Oracle Application Framework Training Manul OAF

Step 3: Now we need to create a page and attach it to the Application Module (AM). Let us see how to create
a page and how to attach it to the AM step wise:
Creating a Page
To create a page Right click on Resources and select New (ctrl+N) as shown in the below picture:
Oracle Application Framework Training Manul OAF

After selecting New option a New Gallery window gets open and left side in Categories extract Web Tier and
select OA Components after selecting OA Components from Web Tier select Page from Items list. The same
similar kind of scenario is shown in the below figure:
Oracle Application Framework Training Manul OAF

Click on OK button after selecting Page from the Items list, after that it will ask for the details of the page give
the name of a page and just check the Package generally no need to change. Click on OK button after giving
Name.

Now a page will be created with the given name. Check the Applications Navigator structure, Extract
Application Sources Folder, extract the Package and also extract Project, server, webui we can see the names
of AM, Page , and Project what we created, in the below figure PO is the short name of the Responsibility ->
Purchasing, Vision Operations (USA).
Oracle Application Framework Training Manul OAF

Step 4: Now we need to attach page to the AM, for that follow the following steps:

select the .xml page from the structure Webui

Down in the page structure (WelcomePG.xml – Structure) select region1.

Change the ID value in the Property Inspector (note that the 3rd step is not mandatory if we want we can
ignore it as of now)
Oracle Application Framework Training Manul OAF

Select BC4J in Property Inspector and then select AM Definition click on the icon to select the AM
Definition.

Select Proper AM definition and then click on Ok.


That’s it we finished the process of attaching page to AM.

Step 5: Giving Window Title and Title of a page.


In the property inspector select Visual and in that we will find Window Title and Title give appropriate names.

Window Title in the name which is displayed in Title bar and Title Comes inside the Page.
Oracle Application Framework Training Manul OAF

Now the last step is running the Program to see the output for that select the .xml page name Applications
Navigator and then Right Click on .xml page ( for example WelcomePG.xml ) and then later

select Run ( )option.


Oracle Application Framework Training Manul OAF

The output of our page is as follows, have a look in to the below picture:
Oracle Application Framework Training Manul OAF

Displaying Images on Page

Let us see how to put images in OAF. The following are the two ways we can keep images in OAF pages:

I) Changing the ORACLE logo to company branding logo.

II) Displaying Images in Page.

1) Changing the ORACLE logo to company branding image.


All the images in Oracle Applications are available in OA_MEDIA directory.
Step 1:
If we want to know the path where exactly the OA_MEDIA directory exists in Sever, Open a third party tool
which connects to the Sever in command prompt like Putty connection manager.

Type the following command in putty:

cd $OA_MEDIA
After that now type the following command which shows the path were exactly the OA_MEDIA directory exists.

pwd
(Present Working Directory)

Step 2:
Now move the Image from the desktop system to the sever using putty or using other graphical user interface
tool like WinSCP.
Oracle Application Framework Training Manul OAF

Step 3:
Open the page which is already created ( example Welcome Page ), here we are taking the Welcome page
which is already created in the previous chapter.
Select the .xml page from Applications Navigator, and we know that we can see the page structure after
selecting .xml page if you didn’t find the page structure then use the keyword Ctrl+Shift+s or go to View ->
Structure to select the Page structure palette.
In the page structure select CorporateBrandingImage.

In the Property Inspector of corporateBrandingImage we can see Image URL in Visual field as shown in the
below figure:
Oracle Application Framework Training Manul OAF

just remove the .gif file name and give the appropriate name i.e,. give the logo name which ever is move to
OA_MEDIA directory. For example look into the below figure:
Oracle Application Framework Training Manul OAF

Note that still now we not yet moved our sample or welcome page to the Oracle Apps Server instance so there
fore if we run the program then we cannot see the logo. To see the corporate branding image locally move the
image to the folder “OA_MEDIA” so that we can see the corporate branding image in OAF pages.

the OA_MEDIA folder will be available in the following path

<patchfile_folder>\jdevhome\jdev\myhtml\OA_MEDIA

Now run the page so that we can see our Corporate logo in the OAF Pages as shown below:

II) Displaying Images in Page.


To display a image in OAF page we need to create a Item first. Let us see how to create a Item, Right click on
the PageId in the Structure of the page select New -> Item as shown in the below figure:
Oracle Application Framework Training Manul OAF

After that select the item which we created just by clicking or selecting item, Property Inspector will be
highlighted in the Property Inspector select Item Style as image as shown in the below figure:
Oracle Application Framework Training Manul OAF

Now after selecting Item Style as image now select the visual field in properties and give the image path which
you want to display in Image URI field as shown in the below figure. Note that we need to move the image as
usually to the respective OA_MEDIA folder/Directory.
Oracle Application Framework Training Manul OAF

Run the page and see the output we can find the images as shown below:

Creating Items and Regions In a Page

In this lesson we will learn how to create Items in OAF page and also we learn how to create Regions in a page.

Here we are taking the same Welcome Page which we created /learned in the previous lesson.
Oracle Application Framework Training Manul OAF

Creating a Region in OAF page:


Select the .xml page in Applications Navigator. In the page structure Right click on PageId (example
“WelcomePageId” which we created early in the previous lesson Welcome Page) and then select New -> Region

By default JDeveloper takes it as a Header region. We got different types of regions available in the
JDeveloper, which are:

1. advancedSearch
2. advancedTable
3. bulletedList
4. cellFormat
5. contentContainer
6. contentFooter
7. defaultDoubleColumn
8. defaultFormStack
9. defaultSingleColumn
10. defaultStack
11. flexibleLayout
12. flowLayout
13. gantt
14. graphTable
15. hGrid
16. header
17. hideShow
18. hideShowHeader
19. labeledFieldLayout
20. messageComponentLayout
21. navigationBar
22. pageButtonBar
23. popUp
24. query
25. rowLayout
26. shuttle
Oracle Application Framework Training Manul OAF

27. stackLayout
28. sub TabLayout
29. switcher
30. table
31. tableLayout
32. train
33. tree

Give some text in Visual -> Text:, for example “Header Region” text field as shown in the below figure:

Run the page after giving Text field value and see the output the output will look like:
Oracle Application Framework Training Manul OAF

In the output observe how the Header Region is appearing and how it looks like we will discuss some important
regions which we generally use in OAF pages in the coming chapters.

Creating a Items in OAF page:


Let us see how to place items in the OAF Page regions and how to place items in the OAF page:

Here we already created a Header Region and if you observe in the above picture the id value of the region is
“region1″ .
Right click on the region1 select New -> Item as shown in the below figure:
Oracle Application Framework Training Manul OAF

Now we can see item1 got created under region1.

In the item1 properties if we observe the default style of the item is messageTextInput (which takes input
values from user) and give some text for prompt ( for example “Header Region Item1 :”). The same scenario is
shown in the below figure:

We have different styles for items which are listed down:


1. attachmentLink
2. attachmentTable
3. button
4. exportButton
5. flex
6. formParameter
7. formValue
8. formattedText
Oracle Application Framework Training Manul OAF

9. image
10. link
11. messageCheckbox
12. messageChoice
13. messageDownload
14. messageFileUpload
15. messageInlineAttachment
16. messageLovChoice
17. messageLovInput
18. messageRadioButton
19. messageRadioGroup
20. messageRichTextEditor
21. messageStyledText
22. messageTextInput
23. rawText
24. resetButton
25. richContainer
26. richTextEditor
27. separator
28. serveletInclude
29. spacer
30. staticStyleText
31. submitButton
32. tip
33. urlInclude
Similarly create one more item in the header region, and for item2 in the properties give prompt (
example Header Region Item2 : ). So therefore the page structure looks like:
Oracle Application Framework Training Manul OAF

Now create one more item but create it on the pageID so that let us see how the items are going to be
displayed in the output, note that we don’t know how the items appear in the page at design time and how the
output looks like.

Right Click on the pageID of page structure and then select New -> Item as shown in the below figure:
Oracle Application Framework Training Manul OAF

After that for the created item3 in Property Inspector give the promt (for example – “ Item1 in the Main page
:”)

The same thing is shown in the below figure:


Oracle Application Framework Training Manul OAF

Now run the page and see how the page looks like.

The output of the page will look like the following, and observe how the items are displaying in header region
and how they are looking out of header region.
Oracle Application Framework Training Manul OAF

How to display User Name, User Id and


Responsibility in OAF

In this lesson we are going to learn how to display Oracle Applications User Name, User Id, Responsibility
Name and Responsibility Id.
We will see little bit java programming too in this chapter.

Steps to follow:

1. Create a page first, see the chapter Welcome Page Creation to see how to create a page.
2. Create the region and four items in the region, we can see the creation process of Regions and Items
in Previous Chapter.
3. Create the controller and write the Java Code.
Here I am taking the page which is already created and adding a region with region style as ” message
Component Layout “.

After adding Region under region here we are creating four items and Item style of all the four items is
“ message Text Input ”.
After adding Region and Items the page structure will look like:
Oracle Application Framework Training Manul OAF

Now change the prompt values for each items as follows:

(if you want to know how to change the prompt values in the Property Inspector see the Previous
Chapter which shows how to change the prompt value)

Prompt
item1 -> User ID
item2 -> User Name
item3 -> Responsibility ID
item4 -> Responsibility Name

The below picture shows how the output structure looks like after running the page, just have a look into it
Oracle Application Framework Training Manul OAF

Now we need to create a Controller, let us see how to create a controller in JDeveloper (OAF).

Best practice is to create the controller Globally so that it should be applicable to all the child regions.

Right Click on the Main Region and then select Set New Controller…

After choosing Set New Controller, one dialog box window opens and it shows some default package and also
some default name, in Package name at last generally we will find ”.webui.webui” change it to single webui
Oracle Application Framework Training Manul OAF

i.e,. nothing but remove one webui from the default package name, for example assume the defualt pakcage is
as follows:

newtonapples.oracle.apps.po.welcomeprj.webui.webui

change it to

newtonapples.oracle.apps.po.welcomeprj.webui

If you want to know why webui is there at end means you can see the BC4J file Structure lesson which displays
the file structures.

give the class name and we know that every controller ends with CO. For example give the controller name as
WelcomeCO as shown below:

Click on OK button after giving Class Name and also after deleting one webui from the package. Now if you
observe Applications Navigator structure controller is created under webui. Select the controller
(WelcomeCO.java) and see the java program how it looks.

In the java program WelcomeCO class is created which is extending OAControllerImpl which contains main
method.

We can also see two methods namely

1) public void processRequest(OAPageContext pageContext, OAWebBean webBean)

the above method is used whenever we want any logic to be implemented before the page gets loaded. It
means while loading a page if we want to display (or) perform any business logic then we go
for processRequest.
Oracle Application Framework Training Manul OAF

2) public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)

this method is used if we want any changes to be made once after the page gets loaded, i.e,. after the page is
loaded suppose after clicking on particular button if we want to display the result into another item or after
clicking on button if we want to go to another page.
As of now our requirement is to display the User ID, User Name, Responsibility ID, Responsibility Name
whenever page gets loaded automatically all the fields to be displayed in the respective items. So therefore we
need to write our program logic in the processRequest.

Look at the below figure we declared four variables of type String and if you observe for number/id values we
are just converting those values into the string. In the OAPageContext we will be having some defined values
which we can access as shown in the below figure using notation dot (.) we will get all the available values and
then we need to choose the required one.
Oracle Application Framework Training Manul OAF

“pageContext” is nothing but the variable name of the OAPageContext (OracleApps page Context), if you
observe to declared four variables we assigned values respectively.

Now after declaring variables and assigning values to the variables, we need to search for a items in our page,
if you observe we created four items item1, item2, item3, and item4. So therefore to find the items in the page
we need to use the bean as follows:

Here in this lesson we are not providing access to copy and paste the code of java, because whenever we are
typing code JDeveloper prompts us to import the packages automatically. For example look at the below figure
whenever we start typing, JDeveloper prompts us to click on Alt-Enter so that we can import the required
package. It just saves our typing time of importing a package.

After clicking on Alt-Enter it displays the packages list then choose the required import package. Here we are
typing OAMessageTextInput it is a bean if you observe we used item style as “MessagetextInput” we are just
adding OA (OracleApps) at the beginning and Bean at last which gives our Bean name. Now look at the below
figure which shows the imported package name:
Oracle Application Framework Training Manul OAF

If you observe first we initialized a bean and at the time of initialization we also need to import the respective
package and hence now we know that how to import automatically the required package. After that declare a
variable and we used java typecasting process here .

Every item has its own id so we used id value of the item to find the required item in the page.

Similarly write the code to find all the items in the page which we created.

Now after finding the items in the page we need to assign values which we got using pageContext into the
respective items. It means we need to set a value for each item in the page and for that we use the line code
as follows:
Oracle Application Framework Training Manul OAF

Similarly set values to all the items and after that the code looks like:
Oracle Application Framework Training Manul OAF

Rebuild the program after finishing the code, just Right click on the code area and then select Rebuild option or
we can also use a short cut code Alt+Shift+f9. Same scenario is shown in the below figure:
Oracle Application Framework Training Manul OAF

After successfully rebuilding the java program Run the page and see the output. The output of the page which
we created is as follows:
Oracle Application Framework Training Manul OAF

Chapter 5: Regions In JDeveloper


Message Component Layout Region

In this chapter we are going to learn creation of regions in the page and for each region here we are taking two
or more items with item style as “messageTextInput” so that we will come to know that how the items are
placed in the regions. Each region will place items in different styles. Let us see some layout regions:

1) Message Component Layout Region


First create one Project which we learned in previous chapters like Welcome Page creation.
After creating a page, go to page structure and select region after selecting region right click on the region and
then select New-> Region. Now a region will be created under a page region.
Oracle Application Framework Training Manul OAF

After creating region change the region style to “MessageComponentLayout” in the property Inspector as
shown in the below figure:
Oracle Application Framework Training Manul OAF

Observe the property inspector and in the visual we added 1 to the rows and 3 to the columns, to see how this
rows and columns effect. See the output and observe the items how they are placed by JDeveloper
automatically, for that first create items under MessageComponentLayout region, here we created 5 items
under the message component layout region and then after creating see the structure of the page how it looks
like:
Oracle Application Framework Training Manul OAF

Give the prompt names to each items and remember here we are taking item style as “messageTextInput” for
all the items, run the page and see the output to see how the items are placed in message Component Layout
region:

Follow the next lesson which shows Header Region how it looks like.

Header Region

In previous lesson we learned how the Message Component Layout region looks like and how to create it, now
using the same page here in this lesson we are going to see how the Header Region looks like and what are the
properties available in the Header region in JDeveloper.

Header Region Creation


Right click on the main region and select the New -> Region as shown in the below figure:
Oracle Application Framework Training Manul OAF

Select the region style as Header and if we observe in the visual area we can provide Text, give some text like
Header Region and while when comparing this header region with the message component layout region we
can observe that in message component layout region we don,t have a option to provide Heading text where as
in Header region we can provide headings but item control is not there like rows and columns in
MessageComponentLayout Region.

The below figure shows the property inspector of Header Region just have a look:
Oracle Application Framework Training Manul OAF

Now after creating Header region create three items with Item Style as MessageTextInput:
Oracle Application Framework Training Manul OAF

Similarly create two more items to see the items arrangement in Header Region, and note that for all the items
the item style is MessageTextInput.

Give some prompt names to all the items:

After creating three items the structure of the page looks like the following:
Oracle Application Framework Training Manul OAF

Now run the page and see the output here we can identify the difference between Header region and
MessageComponentLayout region:
Oracle Application Framework Training Manul OAF

Row Layout Region

In this lesson we are going to see how the rowLayout Region looks like and how the items are displayed inside
the rowLay0utRegion.

Creating Row Layout Region


First create one page, here we are taking the same page which we created in the previous chapters and it
already contains MessageComponetLayout region and Header region.

Create one region, right click on the main region and then select New -> Region

Select region style as “rowLayout” in the Property Inspector, and if we observe the Property Inspector we have
Horizontal Alignment and Vertical Aligment .

Center, End, Left, Right, Start are the available alignments for Horizontal. By Default , Default is the alignment
type which is nothing but works as Start Alignment.

For Vertical Alignment Bottom, Middle, and Top are the available alignments.

The below picture shows the property inspector of Row Layout Region:
Oracle Application Framework Training Manul OAF

After creating RowLayout region create four items under the rowLayoutRegion and also give prompt names for
each created items under RowLayout region.

Now run the page and see the output, it displays all the items in single row.

The below figure shows how the output looks like and also observe that in the below figure how the items are
placed in MessgeComponentLayout region and Header Region along with the Row Layout region.
Oracle Application Framework Training Manul OAF

Default Double Column

In this lesson we are going to learn about Default Double column region which generally displays Items in only
two columns, let us create a Default double column region and create some items init and see how it looks like.

Creating Default Double Column Region


First create one page in the project and then under the main page region create one new region.

Right click on the main region, select New -> Region.


Oracle Application Framework Training Manul OAF

In the property inspector select the region style as “defaultDoubleColumn”.

After selecting Region Style as Default Double Column we can see in the visual Text and Item URI fields are
available it means for Default Double Column we can give Text value to the region and also we can place any
images if required.

The below figure shows the Property Inspector of Default Double Column:
Oracle Application Framework Training Manul OAF

Now after creating Default double Column region create three items under Default Double Column region and
note that all the items the Item Style is messageTextInput and give some prompt name for all the created
items.

After creating items under the default Double Column region the page structure look like the following which
shows Default Double Column region and along with also shows items structure of Message Component Layout
region , Header Region , and Row Layout region.
Oracle Application Framework Training Manul OAF

In the above figure region5 is the Default Double Column.

Now run the page and see the output which shows how the items are placed inside the default Double Column
and also it compares with the other regions.
Oracle Application Framework Training Manul OAF

Default Single Column

In this lesson we see how to create Default Single column and how the items inside the Default Double column
appears in the OAF (Oracle Apps Framework) page.

Creating Default Single Column


First create one page in the project and then create one region under the main region as shown in the below
picture:

Right click on the main region, select New -> Region.


Oracle Application Framework Training Manul OAF

Here we are taking the page which we created in the previous chapters. After creating the region select the
Region Style as “DefaultDoubleColumn”, the below figure shows the Property Inspector of Default Double
Column.
Oracle Application Framework Training Manul OAF

Now create three items under Default Single Column region and also give prompt names to each
MessageTextInput items created:

After creating three items and giving prompt names now run the page and see the output how the items in the
Default Single Column region are displayed.

In the below figure if you observe we can see the difference between other regions along with the Default
Single Column.
Oracle Application Framework Training Manul OAF

Page Button Bar

In this lesson we are going to learn how to create Page Button Bar.

In the Page Button Bar region the items what we placed under it we can see in top and bottom of the pages. It
means this region is helpful if we scroll down to the page and we need to click on some button to perform
certain action then we can create those items under Page Button Bar region.
Oracle Application Framework Training Manul OAF

The items inside Page Button Bar works just like in our mail accounts generally if we open a mail then we can
delete that mail by clicking on Delete button and if we observe in most accounts Delete button is available on
top of the mail and even bottom.

Creating Page Button Bar


First create one page in a project.

Here we are taking the same page which we created early contains five other regions.

Under the main region in a page create one more region and select region style as “Page Button Bar”.

The property inspector of Page Button bar is:


Oracle Application Framework Training Manul OAF

After creating region with Region Style as “Page Button Bar”, create two items under the region and select
Item Style as SubmitButton.
Oracle Application Framework Training Manul OAF

For one Submit Button item give prompt as “Ok” and for other give prompt as “Cancel”.

Now after creating items under the Page Button Bar region, run the page and see the output we can see in the
output items will be displayed on top and bottom of the page. Look at the below figure which shows the look
of output and also it shows how the items in the other region are placed:
Oracle Application Framework Training Manul OAF

Query Region

In this lesson we are going to see how the Query Region is going to look in OAF page and what is the use of
the Query Region in OAF.

Generally we use Query Region in search pages.


Oracle Application Framework Training Manul OAF

So therefore we are going to see how to create this Query region in the next coming chapter called “Search
Pages in OAF”.

We have four types of searches in OAF.

1. Automatic Search Inline LOV


2. Automatic Search External LOV
3. Result Base Search
4. Manual Search

Chapter 6: Items In JDeveloper


Message Text Input

In this chapter we are going to learn how to create Items and we will see some items in the OAF page how
they look.

We already seen in previous chapter that how many items are available and how to create a item.

Here we are going to see different types of items in OAF how they appear in the page.

Creating Message Text Input Item


The Message Text Input items allows users to enter some text value by the user. For example in mail id User
Name, password we will find some text to enter and those kind of items here in OAF are called as Message Text
Input items.
Oracle Application Framework Training Manul OAF

First create one project and create one page under the main region create one “Message Component Layout ”
region.

Create two Message Text Input items under Message Component Layout Region and give prompt names to
each item.

To make the item required one in the Property Inspector select showRequired and make to True so that the
items become required field.

Now for the item if we want the text in disable mode like the way we usually see while entering Password the
text appears in dots rather than displaying text. In OAF for that feature, select item and in Property Inspector
select Security -> Secret.
By default it sets to False make it True.
Oracle Application Framework Training Manul OAF

Run the page and see the output, the below figure shows the output which shows the Message Text Input
items what we created:

Run the page and see the output.

Message Styled Text

In previous lesson we have seen the usage of Message Text Input which allows users to enter the text. Now let
us see how the Message Styled Text appears.

If we want a read only text in OAF output page then we can go for an item with Item Style as Message Styled
Text.
Oracle Application Framework Training Manul OAF

First create One Region (Message Component Layout Region) and then now create two items.

Select Item Style as Message Styled Text in Property Inspector (or) if we are using Message Component Layout
region then select New -> MessageStyledText.

Create two items for example and give some prompt name. Run the page and see the output:

Message Check Box

Let us learn how to create Check Biox items in OAF.

Create two items under the region and select Item Style as “messageCheckBox”.

For the Message Check Box check the Property Inspector and we have some features like as follows:

Data
Initial Value : Assigns a default value give this value to “Y” so that the check box will be checked by default.

Checked Value : This values will be assigned whenever the check box is checked.

Unchecked Value : Value when the item is not checked.

Initially Checked : If we want a value to be checked initially (automatically) then make this value to True.
Oracle Application Framework Training Manul OAF

The following figure shows the Default Data values for the second check box with prompt name as “Check box
two”.

Run the page and see the output here we will see other items too in the below figure along with the Check Box
items.
Oracle Application Framework Training Manul OAF

Message Radio Button

In this lesson we are going to learn how to use Radio Button items in the OAF page.

We can create individual Radio Button items in the page as a named set with mutually exclusive values. It
means we can place radio Buttons where ever we require in a page but if we provided a mutually exclusive
name to all those radio button items then only any one will be checked.

Let us see one small example how to create a Radio Button Items in the page:

Step 1: Create a page and create one Message Component Layout region in a page. Under the region create
four items and select the Item Style as “messageRadioButton” . Example see the below figure:
Oracle Application Framework Training Manul OAF

Step 2: Now after creating Radio Button items give Id values to each items created and assign Prompt name
which ever you wish to display for the radio button.
Step 3: Set the checked value and unchecked value to each radio button in the Property Inspector.
Step 4: If we want radio buttons to behave as a group then we must programmatically assign them all the
same name by calling setName() for each radio button.
First create one controller and write the program in the processRequest().

Remove one webui from the package name and give controller name and note that every controller ends with
CO (general standard).

Write the program in the processRequest(), here I am not providing any access to the code to copy and paste
it in the JDeveloper because whenever we write the code we need to import the package in the program which
we can get automatically from R12 series on wards.

For example whenever we are typing “OAMessageRadioButtonBean” then JDeveloper prompts us to use “Alt-
Enter” to import the required package. So as of now it is better practice to type the code rather than copy and
paste.

We already explained the concept of programming in previous Chapter (Displaying User Name, User ID,
Responsibility Name, Responsibility ID).
Oracle Application Framework Training Manul OAF

The below figure shows the written code in the processRequest():

Now after righting the code rebuild the code by giving Right click on the program select option called Rebuild.

After successful compilation of program run the page and see the output, if we test the output radio buttons we
can select any one out of four available items because we set a unique names to all the items in the program
using variable Name . (dot) setName() method. See the code in above picture for confirmation.

The below figure shows output of the program which shows additionally other items too rather than radio
buttons:
Oracle Application Framework Training Manul OAF

Message Choice

In this lesson we are going to learn how to create Message Choice item in the OAF page.

The bean for message Choice is item is “OAMessageChoiceBean”.

Step 1: First create Item in the page and select Item Style as MessageChoice in Property Inspector.
Step 2: After creating the page create the VO (View Object) in respective BC4J and attach VO to AM
(Application Module).
Creating VO process:
Right Click on Resources folder of project and then select New View Object… as shown in the below figure:
Oracle Application Framework Training Manul OAF

After that a welcome page to create a View Object wizard window will open as shown below:

Click on Next button so that first step to create a VO will come and in that :

Package : Select the proper package name which we created for a project.
Name : give the name to the VO note that all the View objects ends with VO.
Oracle Application Framework Training Manul OAF

Click on Next button:

Click on Next Button, no need to select any package or attributes here:


Oracle Application Framework Training Manul OAF

Click on Next button without any changes:

Click on Next button without any changes so that we can see the Query area to enter SQL query to retrieve the
data, write the SQL Query in the Query Statement
Oracle Application Framework Training Manul OAF

After writing the Query statement check whether the written Query is valid or not by clicking on Test so that if
the query is valid then it shows a message that Query is valid. After that click on Next button.

Click on next button to step 8:


Oracle Application Framework Training Manul OAF

Click on next button and click on Finish button:

After creating VO (view object) we need to attach VO to AM (application Module). Let us see how to attach VO
to AM:

Attaching VO to AM:
Edit the AM which we created in the project, right click on AM and then select Edit <AM Name> as shown in the
below figure:
Oracle Application Framework Training Manul OAF

Select Data Model, extract the package in which VO is created select the VO after selecting the proper VO click
on the Greaterthan arrow symbol which is shown in below figure:

After that we can see the VO is attached to the AM as shown in the below figure:
Oracle Application Framework Training Manul OAF

Click on Apply button and then on OK button so that the attachment process of VO to AM is over.

Step 3: Select the item properties in that do the following:

Picklist View Instance : Give the VO name


View Instance : Attribute Name, the displayed list values. (Column Name, in VO columns are converted
into attributes).
Oracle Application Framework Training Manul OAF

View Attribute : Attribute Name


Oracle Application Framework Training Manul OAF

Now run the page so that we can see the output with drop down list to pick some values. The below image
shows the output of Message Choice along with other items in OAF page.

Note that a drop down list can handle a maximum of 200 values.

Submit Button

In this lesson we are going to see how to create submit button in OAF page.

Here in this lesson we are going to see how to create Submit button Item in Message Component Layout
region, note that we cannot create Submit button directly in Message Component Layout Region for that first
we need to create Message Layout as shown in the below figure:
Oracle Application Framework Training Manul OAF

After selecting Message Layout item under that Item create one more item as shown in the below figure:

After creating Item under the Message Layout item select the Item Style as “submit Button”.

Give prompt name to display on top of the button example “Ok”, run the page and see the output:
Oracle Application Framework Training Manul OAF

Message Rich Text Editor

Let us see how to create Message Rich Text Editor in OAF.

Rich textEditor Item style is deprecated to <Message Rich Text Editor>.

create item and select the Item Style as message Rich Text Editor.

Run the page to see the output . The below figure shows the Message RichText Editor with prompt as
“Address”.
Oracle Application Framework Training Manul OAF

Image Item

We already seen that how to create a Image in OAF page in previous lesson.

In this lesson we are going to see how to create Item in Message Component Layout region.

Directly we cannot create Image item in Message Component Layout Region, so therefore first we need to
create Message Layout item.

The below figure shows the Image item property Inspector under the Message Layout region:
Oracle Application Framework Training Manul OAF

In the Image URI give the path of the image which you want to display. Run the page and see the output:
Oracle Application Framework Training Manul OAF

Chapter 7: Sample Exercises


Displaying Exception Messages Based on
Condition

Let us learn how to create an Exception messages in OAF. This lesson will take us to show that how to create a
Exception messages, alert messages, warning mesesages in OAF pages.

1. First create one page in a project.

2. Create the Region and two items.

One Item to enter text so take it as “Message Text Input” and another items is “Submit Button”. Hence we
already seen in previous chapters how to create Message Text Input item and Submit Button.

3. Create the controller and write the code in the process Form Request, we are going to write the code in
process form request because whenever we click on submit button based on the condition the Message should
be displayed.

Here we are creating one Message Text input item and three submit buttons each button will display different
messages.

The below figure shows the page structure Contains :

Message Component Layout Region

—Under it: Message Text Input Item

: Message Layout Item

—- under message layout item

:Submit Button 1 with prompt : Exception

:Submit Button 2 with prompt : Alert

:Submit Button 1 with prompt : Warning


Oracle Application Framework Training Manul OAF

Now run the page and just see the output how it looks, the below figure shows the sample output and if we
observe there is no gap between Submit Buttons and Message Text Input Item.

Now to create a space between buttons and items we have one item called “spacer”. Create two items under
Message Layout and select Item Style as spacer and in Property Inspector give width as 10.
Click on the spacer item hold it and drag it between the Submit Button items, in Message component Layout
region directly we cannot create spacer item so there fore create one message layout hold that item and place
between Message Text Input item and Message Layout Item which is created early.

Now under the second message Layout item create one item with Item Style as “spacer” and give height as 10
in Property Inspector.
Oracle Application Framework Training Manul OAF

After creation the page structure looks like the following:

Create the controller under the main region and write the code logic in “process Form Request”.

public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)


{
super.processFormRequest(pageContext, webBean);

if(pageContext.getParameter("item3")!=null)
{
String name=pageContext.getParameter("item6");
throw new OAException(name,OAException.ERROR);
}
if(pageContext.getParameter("item4")!=null)
{
String name=pageContext.getParameter("item6");
throw new OAException(name,OAException.CONFIRMATION);
}
if(pageContext.getParameter("item5")!=null)
{
String name=pageContext.getParameter("item6");
throw new OAException(name,OAException.WARNING);
Oracle Application Framework Training Manul OAF

}
}

In the above code item3, item4, item5 are the id values of the Submit Button items with prompt Exception,
Confirm, Warning. Item6 is the id value of Message Text Input item.

The import package is :

import oracle.apps.fnd.framework.OAException;

run the page and see the output. Give some text in Message Input Text and then click on the button to see the
messages displayed on OAF. For example see the following:

Swapping The Value From One Field to Another


Field

In this lesson we are going to see how to swap a values from one field to another.

Steps to follow:

1. Create a Page and create Message Component Layout Region


Oracle Application Framework Training Manul OAF

2. Create two items one Message Text Input and other is Message Styled Text with prompts as “Enter some
Text :” and “Entered Text :”.
3. Create one button so that when we click on button swapping process to done.
4. Create Controller and write the Swapping logic in ProcessFormRequest.
We already know that how to create a page and how to create a region, the following figure shows the page
structure in JDeveloper:

Now on the main region create Controller and write the logic in Process Form Request, and the code is :
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)

{
super.processFormRequest(pageContext, webBean);

if(pageContext.getParameter("item3")!=null)
{
String name=pageContext.getParameter("item1");
OAMessageStyledTextBean mst=(OAMessageStyledTextBean)webBean.findChildRecursive("item2");
mst.setValue(pageContext,name);
}
}

In the above program item1 is id value of the Message Input Text item, item2 is the Id value of the Message
Styled Text.

Rebuild the code and run the page to see the output.

Enter some text in the field and click on swap button for swapping.
Oracle Application Framework Training Manul OAF

If we want to place or clear the text what we entered then write the following additional code:
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)

{
super.processFormRequest(pageContext, webBean);

if(pageContext.getParameter("item3")!=null)
{
String name=pageContext.getParameter("item1");
OAMessageStyledTextBean mst=(OAMessageStyledTextBean)webBean.findChildRecursive("item2");
mst.setValue(pageContext,name);

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


mtib.setValue(pageContext,null);
}
}

Displaying Data From Data Base

In this lesson we are going to see how to display a data from the data base in OAF.
Oracle Application Framework Training Manul OAF

Follow the steps to display the data in OAF page from the Data Base:

1. Create the page.


2. Create the VO in respective BC4J and attach it to AM.
3. Create the controller and write the logicode in Process Form Request.

To create a VO right Click on the Resources Folder of the project and then select New View Object…

To see all the steps that how to create the VO we can see in previous chapter.

Write the following Query statement in VO

SELECT * FROM mtl_system_items_b WHERE ROWNUM < 101

After creating VO attach VO to AM (Application Module).

Now select main page right click on the main region select New -> Region Using Wizard…

After selecting Region Using Wizard then a welcome window will get open as shown below:
Oracle Application Framework Training Manul OAF

Click on Next button to see the first step:

After selecting proper AM we can see the VO attached to that AM in the Available View Usages, which is shown
below:
Oracle Application Framework Training Manul OAF

Click on Next button, in Step2 window select Region Style as “table“, the same scenario is shown in the below
figure:

In the next window we will find all the available attributes and in that select the attributes whichever required
to display.
Oracle Application Framework Training Manul OAF

Click on Next button then we will find a window in that we can change the prompt names if required and also
the style of the item we can change here we are taking all the items as Message Text input types.

Click on Next button and then click on the finish button.


Oracle Application Framework Training Manul OAF

After creating Region Using Wizard now create one more item and the Item Style is “Submit Button”. So that
the page structure looks like the following:

Now create one controller on the main region. Right click on the region1(Main region id) and then select Set
New Controller…
Now after creating the controller write the following code in the process Form Request.

public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)

{
Oracle Application Framework Training Manul OAF

super.processFormRequest(pageContext, webBean);

if(pageContext.getParameter("item1")!=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("ItemsVO1");

/* ItemsVO1 is the instance name in AM which is the original name of the VO */

vo.executeQuery();
}

Rebuild the code, run the page and see the output:
Oracle Application Framework Training Manul OAF

Click on the “Go” button so that it will display the records as shown below:
Oracle Application Framework Training Manul OAF

Data Entry Page in OAF

In this lesson we are going to see how to add data into the Data Base tables.

The following are the steps to follow:

1. Create the WorkSpace and Project.


2. Create the AM.
3. Create the page and attach AM to page.
After creating the above three steps now let us create one sample table to enter the data.
CREATE TABLE xx_newton_employee (empno NUMBER(7),
ename VARCHAR2(30),
salary NUMBER(10),
doj DATE,
address VARCHAR2(20),
--WHO COLUMNS
last_update_date DATE NOT NULL,
last_updated_by NUMBER NOT NULL,
creation_date DATE NOT NULL,
created_by NUMBER NOT NULL,
last_update_login NUMBER);

Now after creating table we need to enter the data into the table for that we know for any kind of DML
operations we need to go for Entity Object in OAF, so now let us create EO on the created table. The following
process shows how to create a EO in OAF.

Creating EO
Right click on the folder Resources which is under the Project in Application Navigator and then select New
Entity Object… as shown in the below figure:
Oracle Application Framework Training Manul OAF

The below figure shows the welcome screen which we will see whenever we click on New Entity Object:

Click on Next Button, whenever we click on next button it shows user name in hide mode and password, no
need to do any changes here because generally we will set project properties, click on ok.
Oracle Application Framework Training Manul OAF

Click on OK button and then in Entity Object give Name for EO and select the proper Package name, in the
Database Objects select the proper table name:
Oracle Application Framework Training Manul OAF

Click on Next button so that we can see the attributes available in the Table (attributes are nothing but the
column names of a table which we selected, here all the columns will be converted into attributes).

Click on Next button where in that window we can set all the attributes and in that select the primary key value
if we are not selecting any attribute as primary key the by default it considers ROWID as Primary Key.
Oracle Application Framework Training Manul OAF

Click on Next button and in step4 no need to do any changes:

No need to do any changes simply click on Next button to see the step5.
Oracle Application Framework Training Manul OAF

Click on Next button without any changes:


Oracle Application Framework Training Manul OAF

Click on Finish button, so that EO will be created, here our EO name is “InsertRecordsEO“.
Now after creating EO we need to attach this EO to VO.

Create a new VO, and in step2 select the EO under the package, actually in step2 it prompts us to select EO.
The same scenario is shown in the below figure:

Click on Next button to see the step3 and in step3 now we can see all the available attributes of EO.
Oracle Application Framework Training Manul OAF

In step3 we need to select all the attributes which we want to include, after that click on next button and in
step5 we can see the Query generated, if we want any changes to made in that query then click on Expert
Mode which is unchecked, whenever we click on Expert Mode then the Generated Statement will be highlighted
so that we can modify the query if required:
Oracle Application Framework Training Manul OAF

Click on Next button and finish the VO creation, and now the EO is attached to VO.

After creating VO and attaching EO to VO now we need to attache this VO to AM for that edit the AM as shown
in the below figure:
Oracle Application Framework Training Manul OAF

After editing AM extract the proper package name of our project in that we can see the VO select that VO and
then click on > (Greater than symbol) arrow so that VO will be attached to AM, click on Apply button and then
OK button.
Oracle Application Framework Training Manul OAF

Select the page attach AM to the page and give Window Title and Title in the Property Inspector.

Under the Main region create One Message Component layout region create five Message Text Input Items and
one Submit Button, and one more reset Button.

Give Prompt names to all the items which are created accordingly, like :

item1 (Message Text Input item)

item2 (Message Text Input item)

item3 (Message Text Input item)

item4 (Message Text Input item)

item5 (Message Text Input item)

item6 ( Submit Button)

item7 (Reset Button)

After creating items now the page structure looks like the following:
Oracle Application Framework Training Manul OAF

Select each Item and then for each Message Text Input Items select View Instance and View Attribute. The
following pictures shows the selection process for one item.

Note that Data Type and Maximum length must be mapped properly to each item.

Selecting View Instance for an item click on view instance then click on the icon so that the
following window will get opens and then in that select the View Instance.
Oracle Application Framework Training Manul OAF

after selecting View Instance select View Attribute and then click on the icon so that one window
will get opens and in that select the proper attribute.
Oracle Application Framework Training Manul OAF

Now select the AM java program, the scenario is shown in the below picture:
Oracle Application Framework Training Manul OAF

Now create one new method in the AMImpl class, here the method name is “InsertRecord“, write the
following code in the AMImpl class :

public void InsertRecord()


{
InsertVOImpl vo= getInsertVO1();
OADBTransaction trans= getOADBTransaction();
vo.executeQuery();
Row v_row;
v_row = (Row)vo.createRow();
Oracle Application Framework Training Manul OAF

vo.insertRow(v_row);
}

In process request of Controller initialize the AM the following code shows the initialization process of AM in
controller.

public void processRequest(OAPageContext pageContext, OAWebBean webBean)


{
super.processRequest(pageContext, webBean);

InsertRecordsAMImpl am=(InsertRecordsAMImpl)pageContext.getApplicationModule(webBean);
am.InsertRecord(); /* Name of the method which we created in AM */

In the Process Form Request now we need to write the code for the item Save or Add prompt button so that
whenever we click on that button the data will be added into the table.

public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)


{
super.processFormRequest(pageContext, webBean);

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

if(pageContext.getParameter("item6")!=null)
{
am.getOADBTransaction().commit();
throw new OAException("Employee Created sucsessfully",OAException.CONFIRMATION);
}

Now rebuild the code in AM and in Controller and run the page to see the output. Enter the data and click on
Add button to save the entered data into the table.
Oracle Application Framework Training Manul OAF

Run the SQL Query to see the output in DataBase.

SELECT * FROM xx_newton_employee;

Calling One Form to Another Form

In this lesson we will see how to call one page from the current page in OAF. To create link between two pages
we have “pageContext.serForwardURL”.

First create WorkSpace and project.

Create AM, create page and attach AM to the page.

Here we are creating VO which displays employee information which are entered using the previous chapter
page.
Oracle Application Framework Training Manul OAF

We know that to display data we need to create VO, attach VO to AM and then we need to execute the VO
query whenever we click on the button, so there fore for that we need to write the code in the Process Form
Request of Controller.

To know how to display data from the data base see the chapter called Displaying Data from DataBase.

Let us see the parameter list in “pageContext.setForwardURL”.

example code is :

line1 : pageContext.setForwardURL (DestinationPagePath,


line2: null,
line3 : menu_context,
line4 : null,
line5 : params(null),
line6 : RetainAM(true),
line7 : ADD_Bread_Crumbs,
line8 : Ignore_Messages);

In line1 :- Destination Page Path : Complete path of the OAF page.


line2:- null : If we want to call oracle apps form then 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.
line3:- menu_context: We can include any number of menus as we require.
line4:- 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.
line5: -params(null) : If we want to carry the values then we pass those values here.
line6:- RetainAM(true): generally this will be set to true value.
line7: -Add_Bread_Crumbs: If we want the link to carry to next page and store in the memory.
line8:-Ignore Messages: It will restrict the messages to not to carry from one page to another.

In this chapter we used displaying data of employees information which are entered in Data Entry page of
previous lesson, if we want to see the employees information then we need to click on the button “Get
Employee Information” and to create a new employee we need to click on “Create Employee” button.

The page structure of the Project what we are using now contains one main region and under it One Table
Using Wizard Region, two submit buttons. The following figure shows the page structure:
Oracle Application Framework Training Manul OAF

If we run the page after creating VO and executing that VO whenever we click on the “Get Employee
Information” then the output looks like the following:
Oracle Application Framework Training Manul OAF

If we observe in the output whenever we click on the Create Employee button it must take us to the Create
Employee page which we created and seen in previous lesson.

Whenever we click on the Create Employee button then only it must take us to the Create Employee page so
for that we need to write the code in the “processFormRequest” of controller and the code in
processFormRequest is:

if(pageContext.getParameter("item3")!=null)

{
pageContext.setForwardURL("OA.jsp?page=/xxapples/oracle/apps/po/insertingrecords/webui/InsertDataPG",
null,
OAWebBeanConstants.KEEP_MENU_CONTEXT,
null,
null,
true,
OAWebBeanConstants.ADD_BREAD_CRUMB_YES,
OAWebBeanConstants.IGNORE_MESSAGES);
}

In the program “item3″ is the id value of the Create Employee button. When we rebuild the code and run the
page then the output looks like the following:
Oracle Application Framework Training Manul OAF

Now after clicking on the Create Employee button it leads us to Create Employee page:

SPEL In OAF

SPEL stands for “Simplest Possible Expression Language”.

SPEL is used to carry the values dynamically. SPEL will get the value dynamically at runtime. SPEL is the
Boolean Value (True / False). The syntax of SPEL is:
Oracle Application Framework Training Manul OAF

Now let us see the previous chapter output which shows the Employee Information when we click on “Get
Employee Information” button now the same output we are adding one image icon so that it appears to each
and every row as shown in the below figure:
Oracle Application Framework Training Manul OAF

Now we will see the process how to add edit image for each row in a table. For that first we need a page
structure as follows:
Oracle Application Framework Training Manul OAF

In the above page structure we created a region Using Wizard and the region style is “Table”. Item1 is the
submit button whenever we click on the Submit Button(Get Employee Information) it displays the employee
information as shown in the below figure:

Now go to the table region, right click on the table region select New -> Item.
In the Property Inspector of item do the following changes:

1. Select the Item style as image.


2. In Image URI give the name of the image for example for edit image we have predefined images in
“p9879989_R12_GENERIC\jdevhome\jdev\myhtml\OA_MEDIA” , give the following image in Image
URI /OA_MEDIA/detailsicon_enabled.gif.
3. In client action select Action Type as “fireAction“.
4. In client action give Event name as “Edit“
Now the page structure looks like:
Oracle Application Framework Training Manul OAF

Now run the page and click on the button “Get Employee Information” so that the output looks like the above
picture what we have seen early.
Now whenever we click on the image item then it must show us the information in different form, for that we
need to write the following code in processFormsRequest of controller:

if("Edit".equals(pageContext.getParameter(EVENT_PARAM)))
{
pageContext.setForwardURL("OA.jsp?page=/xxapples/oracle/apps/po/insertingrecords/webui/InsertDataPG",
null,
OAWebBeanConstants.KEEP_MENU_CONTEXT,
null,
null,
true,
OAWebBeanConstants.ADD_BREAD_CRUMB_YES,
OAWebBeanConstants.IGNORE_MESSAGES);
}
Oracle Application Framework Training Manul OAF

in IF condition “Edit” is the Client Action Event Name which we have given. The remaining code logic is same
which we used in previous chapter takes us to create employee page but here we need to carry the data to
that page rather than creating employee.

To achieve these requirement we need to create a spell, keep continue reading so that we will come to know
how to create a SPELL in OAF.

SPEL creation in OAF, we know the syntax of SPEL now we need to create a SPEL for the image item in a table.

The SPEL value for the above is as follows:

${oa.EmployeeSearchVO1.Empno}
EmployeeSearchVO1 is the name of the VO which is used to get the details of employees.

Empno is the primary key value (attribute name)/ column name of the table in view.

Now we need to pass the above spel to image, for that select the image and then in Property Inspector,

Client Action -> Parameters

Once we click on the icon a Parameters window will get open in that, click on Add Parameters button and then
give some name (example pempno) in the value pass the SPEL what we created
( ${oa.EmployeeSearchVO1.Empno} ). After giving name and passing SPEL value in the Value field click
on OK button.
Oracle Application Framework Training Manul OAF

Now we need to call this parameter in the Create Employee page CO because whenever we click on the image
item in the table list showing employee details it takes us to the Create Employee Page but it will not carry any
values here our task is to carry values.

So therefore we need to write the code in processRequest of the controller class of Insert Employee details
page. The code is as follows:
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processRequest(pageContext, webBean);

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

if(pageContext.getParameter("pempno")!=null)
{
String hid = pageContext.getParameter("pempno").toString();
String whereclause = "EMPNO='"+hid+"'";
am.getEmployeeCreateVO1().setWhereClause(null);
am.getEmployeeCreateVO1().setWhereClause(whereclause);
am.getEmployeeCreateVO1().executeQuery();
}
else
{
am.InsertEmployeeRecord();
}
}

Now rebuild the code, rebuild the pages run the Employee Information Page, click on the Get Employee
Information button and then click on the image item which is displayed on each available rows so that it takes
us to create employee page but here it carries the row values. The sample output is shown in the below figure:
Oracle Application Framework Training Manul OAF

Chapter 8: Search Pages In OAF


Search Pages in OAF

In this chapter we will see how to create search pages in OAF and how many different types of search pages
are there in OAF.

We have three types of search pages in OAF

 Automatic Search
 Result Base Search
 Manual Search
Automatic Search is again divided into two types:
1. Inline LOV
2. External LOV
Automatic Search and Result Base Search will take care by the Query Region where as for Manual Search we
have to write the condition manually.
We will see in the coming chapters how to create the search pages in Oracle Apps Framework.

Automatic Search Inline LOV


Oracle Application Framework Training Manul OAF

In this lesson we will see how to create Inline LOV search page.

Inline LOV is used to search with in the page.

The following are the steps to create Inline LOV

Step1: Create the new WorkSpace and project, create new page add AM to the page.
Step2: Create new VO in respective BC4J. While creating VO change the package name of BC4J to
“.lov.server” at end, generally List of Values VO ends with LOVVO and the example BC4J path is:

Package (BC4J) : xxinlinelov.oracle.apps.po.inlineprj.lov.server

VO name : InlineLOVVO

Query in the VO is:

SELECT first_name FROM PER_ALL_PEOPLE_F

The Application Navigator of the project now looks like:

Step3: Under the main page create new item and select item style in property Inspector as
“MessageLOVInput”.
We can find List of Values region under Message LOV Input item.
Right click on the List of Values region select New -> Table Using Wizard…
Oracle Application Framework Training Manul OAF

Here we can create Table Style region only we cannot change the region style to another one.
See the below image it shows that how the page structure will look now:

Select the FirstName item under the table region and then in the property Inspector of that item check that in
the Functional, Search Allowed is set to True.

Step4: Select LOV Mappings in the structure of Message LOV input after that do the following changes in the
property inspector of lovMap1.
Functional:
LOV Region Item : FirstName (the item to display in the LOV region)

Return Item : item1 (the item to return)

Criteria Item : item1 (criteria item works like in where condition value)

Run the page and see the output. The first page of the output looks like the following:
Oracle Application Framework Training Manul OAF

click on the search symbol so that it leads us to another page as shown in the below figure:
Oracle Application Framework Training Manul OAF

Check the Radio Button of which employee you want to choose and then click on Select button or use Quick
Select option to select the name which is required.

After choosing the name it will display in the Message Text Input item as follows:
Oracle Application Framework Training Manul OAF

Automatic Search External LOV

In this lesson we are going to see how to Create Automatic Search using External LOV and the uses of external
LOV in oaf. The difference between inline LOV and External LOV is inline lov is used only inside the page where
as external LOV we can use for other pages inside the project.

So therefore the use or advantage of External LOV is if we want a list of values to be used for other pages in
the project then we can create External LOV region and we can use the created region in any pages of the
project.

Steps to create External LOV in oaf are follows:

Step1: Create Workspace, project , AM and create one page assign AM to the page give page title and window
title.
For example :

workspace name : externlallov

Project Name : ExternallovPRJ

package name : externallov.oracle.apps.po.externallovprj.webui

AM name : ExternallovAM

AM Package name: externallov.oracle.apps.po.externallovprj.server

Step2: Right Click on the project select new as shown in the below picture.
Oracle Application Framework Training Manul OAF

After selecting new option we will see a gallery window in that extract web tier in categories select OA
Components and then select Region in items list.
Oracle Application Framework Training Manul OAF

After selecting region click on ok button so that a window will get open in that

Name : Give any user defined name

Package: Select the proper package of the project.

Style : select style as List of values.


Oracle Application Framework Training Manul OAF

Now one .xml region will be created under webui.

Step3: Create on VO under the lov package for example select the package name as follows:
externallov.oracle.apps.po.externallovprj.lov.server

VO Name is : externalLOVVO

Query in the lov is :-

SELECT FULL_NAME FROM PER_ALL_PEOPLE_F

Step4: Attach VO to the AM.


Step5: Under the region create one item and item style as Message LOV input. In previous lesson we already
seen how the Message LOV input item structure look like.
The below image shows how the Application Navigator and page structure of the project looks like:
Oracle Application Framework Training Manul OAF

Step6: Under the Message LOV input region create on table region using wizard. In the table region select the
proper package name and then as we attached our VO to the AM it will display our LOVVO so select that VO
and therefore a table region will be created with one item under it.
Step7: Select the Message LOV input item and in the Property Inspector of Message LOV input select External
LOV as shown in the below figure:
Oracle Application Framework Training Manul OAF

Click on the icon so that the following window will get opens
Oracle Application Framework Training Manul OAF

Click on the Browse button and then select the proper package name for example see the below picture:
Oracle Application Framework Training Manul OAF

Click on the search button and then select the fully qualified name in the search results for example see the
below picture:
Oracle Application Framework Training Manul OAF

Click on OK button so that JDeveloper asks for confirmation in that click on OK button.

Step8: Run the page and see the output. The following three images shows the output and its work process
Oracle Application Framework Training Manul OAF

Click on the search image so that it displays list of values as shown below.
Oracle Application Framework Training Manul OAF

Select any value whichever you want to select. Use Quick select or radio button process:
Oracle Application Framework Training Manul OAF

Result Base Search

In this lesson we are going to see how to create Result Base Search.

Result base search will give the search results so the results whatever we are seeing in the page are just for
display purpose we cannot select the resultant values like the way we select in Inline LOV or External LOV.

Steps to create result base search page in oaf:

Step1: Create Workspace, project , AM and create one page assign AM to the page give page title and window
title.
For example :-

workspace name : ResultBaseSearch

Project Name : ResultbasesearchPRJ

package name : xxresultbasesearch.oracle.apps.po.resultbasesearchprj.webui

AM name : ResultbasesearchAM

AM Package name: xxresultbasesearch.oracle.apps.po.resultbasesearchprj.server

Step2: Create new VO in respective BC4J, generally List of Values ends with VO and the example BC4J path is:
Package (BC4J) : xxresultbasesearch.oracle.apps.po.inlineprj.server

VO name : ResultBaseSearchVO

Query in the VO is:

SELECT PERSON_ID,
Oracle Application Framework Training Manul OAF

FULL_NAME,
DATE_OF_BIRTH,
KNOWN_AS,
NATIONALITY
FROM PER_ALL_PEOPLE_F

Step3: Attach VO to the AM


Step4:- Now after creating VO and attaching it to AM, create new region under main region and select the
region style in property inspector as Query. It means we need to create a Query region under the main region.

After creating Query Region in main region select the Query Region property Inspector and in Property
Inspector select Construction Mode as Result Base search as shown in the below figure:
Oracle Application Framework Training Manul OAF

Now in the page structure select the Query region, right click on the Query region select New -> Region
Using Wizard…

Select Proper Application Module in the first step of creating region as show in the below figure:
Oracle Application Framework Training Manul OAF

In step2 select the region style as Table as show in the below image:

In step3 select the attributes of VO which you want to display in the output.
Oracle Application Framework Training Manul OAF

Finish the Region using wizard process.

Step5:- Run the page and see the output, if we observe in the output the Query region creates automatically
Go and Clear buttons.
Oracle Application Framework Training Manul OAF

Click on GO button to see the resultant output as shown in the below picture:

Manual Search

In this lesson we are going to see how to create manual search page in OAF manually. Manual Search page we
need to enter the data value to search for example employee names starting with ‘A’ then we used to type A%
in oracle apps forms similarly in OAF the manual search page will work like.

Step 1: Create Workspace, project , AM and create one page assign AM to the page give page title and window
title.
For example :

workspace name : ManualSearch

Project Name : ManualSearchPRJ


Oracle Application Framework Training Manul OAF

package name : xxmanualsearch.oracle.apps.po.manualsearchprj.webui

AM name : ManualSearchAM

AM Package name: xxmanualsearch.oracle.apps.po.manualsearchprj.server

Step 2:- Create VO and attach VO to AM


VO Name is : ManualsearchVO

Query in the VO is :-

SELECT * FROM dept

WHERE deptno LIKE NVL(:1, deptno)


AND dname LIKE NVL (:2, dname)
AND loc LIKE NVL(:3, loc)

Step 3:- The below picture shows the requirement so there fore we need to create a page to achieve the
requirement.

Now if we observe the above image we need to create three Message Text Input items for search and two
button items.

After entering data in Message Text Input items and once we click on Go button then according to the search
item provided the resultant values must be displayed in the below table region.

steps to construct the page like above picture:


Oracle Application Framework Training Manul OAF

step 1: Create one message component layout region


step 2: Under message component layout region create three message text input items.
step 3: Create on row layout region, under row layout region create two submit buttons and if we want a
space between two buttons then create one Spacer item between two submit button items.
step 4: Create one region using wizard and select region style as Table, select proper package name in which
we created VO (ManualsearchVO).

After creating all the page structure may look like :

Step 4:- Now open the java file of AM and create one method in AM and write the logic.
public void xxSearchParams (OAPageContext pc,OAWebBean wb)
{
String dno = null;
String dname = null;
String loc = null;
//ManualsearchVOImpl vo= getManualsearchVO1();
Oracle Application Framework Training Manul OAF

OAViewObject vo= getManualsearchVO1();


if(pc.getParameter("item1")!=null)
{
dno = pc.getParameter("item1").toString();
vo.setWhereClauseParam(0,dno);
}
else
{
vo.setWhereClauseParam(0,null);
}
if(pc.getParameter("item2")!=null)
{
dname =pc.getParameter("item2").toString();
vo.setWhereClauseParam(1,dname);
}
else
{
vo.setWhereClauseParam(1,null);
}
if(pc.getParameter("item3")!=null)
{
loc = pc.getParameter("item3").toString();
vo.setWhereClauseParam(2,loc);
}
else
{
vo.setWhereClauseParam(2,null);
}
vo.executeQuery();
}
Oracle Application Framework Training Manul OAF

Step 5:- Create the controller and write the logic for buttons in Process Form Request of controller and here is
the logic.

public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)


{
super.processFormRequest(pageContext, webBean);

ManualsearchAMImpl am=(ManualsearchAMImpl)pageContext.getApplicationModule(webBean);
if(pageContext.getParameter("item4")!=null)
{
am.xxSearchParams(pageContext,webBean);
}
if(pageContext.getParameter("item6")!=null)
{
OAMessageTextInputBean msb = (OAMessageTextInputBean)webBean.findChildRecursive("item1");
msb.setValue(pageContext,null);
OAMessageTextInputBean msb2 = (OAMessageTextInputBean)webBean.findChildRecursive("item2");
msb.setValue(pageContext,null);
OAMessageTextInputBean msb3 = (OAMessageTextInputBean)webBean.findChildRecursive("item3");
msb.setValue(pageContext,null);
}
}

Step 6:- Now after writing logic in AM and Controller rebuild the code and run the page to see the output.
The resultant page may look like the following figure:
Oracle Application Framework Training Manul OAF

Give some text in any Text input field and click on go button.
Oracle Application Framework Training Manul OAF

Chapter 9: Sample Project Work


MD-50 of Sample Project in OAF

Let us see the MD-50 Functional Document of OAF project.

Note that here we are considering one Clinic called Newton Apples Hospitals which is no where located.

Project Requirement
1. Every patient who is coming to clinic for checkup we need to create one OAF page through which we will
enter the details of the patient.

2. We need to create another page which shows the details of the patients it means this page is just a search
page.

3. One more page is for updating the patient entered details.


Oracle Application Framework Training Manul OAF

The following image shows the sample design format according to that we need to design our OAF Page

We guess every field what is there in the design page we know all are patient Details.

Only one field Review is what we need to know here, for every patient who come for initial checkup for him the
next two visits with in 10 days is free of cost and first time the patient is considered as new entry. So there
fore for the first time Review Entry is New.

If the patient is going to visit the clinic next time within 10 days then the patient details entered with separate
patient id but in place of Review rather than the new it will be entered as Review1 or Review2 (Rev1 or Rev2).

After entering the patient details the first and main page will be searching the patient details the below picture
shows the search page design format.
Oracle Application Framework Training Manul OAF

The above design shows the Search page design format.

According to the document we need to create Patient Entry page and Search Page additionally we are also
creating update and details page.

Creating First OAF Page In Project

In this lesson we are going to see how to create the first page in OAF according to our requirement.

The first page is nothing but the patient entry page.

Here we are going to create the patient entry page.


Oracle Application Framework Training Manul OAF

1. First create one Workspace and Project.


2. Create one AM
3. Create one page and attach AM to the page.
For example:
Workspace Name : StirlingVision
Project Name : StirlingPRJ
AM Name : StrilingAM
Package Name: xxstirling.oracle.apps.po.stirlingprj.server

Now according to the document that is based on MD-050 document we need to create the page structure of
Patient Entry page. The below figure shows the page structure with description of each item and regions.
Oracle Application Framework Training Manul OAF

Run the page and see the output, the below picture shows the output of the page.

Now for every value what we are entering in the field must be saved in the data base and for that we know
that we need to insert data into the table.
Create one table which stores the details of patients in Data Base. The Table with who columns is :
CREATE TABLE XXSTIRLING_PATIENT_ENTRY_TABLE(PATIENT_ID NUMBER(10) PRIMARY KEY,

PATIENT_NAME VARCHAR2(40),

REVIEW VARCHAR2(10),

PHONE_NUMBER NUMBER(15),

SEX VARCHAR2(7),

AGE NUMBER(3),
Oracle Application Framework Training Manul OAF

AMOUNT NUMBER(6),

DATE_CHECKED DATE,

ADDRESS VARCHAR2(40),

--who columns

LAST_UPDATE_DATE DATE NOT NULL,

LAST_UPDATED_BY NUMBER NOT NULL,

CREATION_DATE DATE NOT NULL,

CREATED_BY NUMBER NOT NULL,

LAST_UPDATE_LOGIN NUMBER);

Now after creating table we need to create one Entity Object in the project.

Create one Entity Object (EO) in the project

For example:
Entity Name : StirlingPatientEntryEO
Package : xxstirling.oracle.apps.po.stirlingprj.schema.server
After creating Entity Object Create one VO, for example:

View Object Name: PatientEntryVO


Package: xxstirling.oracle.apps.po.stirlingprj.server
Attach EO to VO while creating.

Attach VO to the AM.

After attaching VO to the AM give View Instance and View attribute to each and every item in the page and
check the data type and size of the attribute is mapped properly. We have seen the radio buttons so for both
Radio Button items give the same View Instance and View Attribute and Checked value for Male is MALE,
checked value for Female is FEMALE.

Radio Button validation in a page:


For Radio buttons only one radio button must be checked out of all available radio buttons for that we need to
write the code in the Process Request of the controller.
Oracle Application Framework Training Manul OAF

Create one Controller on the main region and write the following Radio Button Validation code in the Process
Request of Controller:

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

var1.setName("Gender");
var1.setValue("Male");

OAMessageRadioButtonBean var2 = (OAMessageRadioButtonBean)webBean.findChildRecursive("female");


var2.setName("Gender");
var2.setValue("Female");

Add the corporate logo to the page.

Now for storing the data in the Data Base we need to open the AM file and create the method in the java file of
AM

public void xxinsertpatient()


{
PatientEntryVOImpl vo= getPatientEntryVO1();
OADBTransaction trans= getOADBTransaction();
vo.executeQuery();
Row v_row = (Row)vo.createRow();
vo.insertRow(v_row);
}

After writing the method in AM we need to initialize the AM in the Controller, write the following code in the
process Request of controller:

//in the proecessRequest after super class

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

am.xxinsertpatient();

After initializing AM and the method of AM in controller, we have to write the validation code for Add button so
therefore we need to write the code in ProcessFormRequest for Add button as follows:

StirlingAMImpl am = (StirlingAMImpl)pageContext.getApplicationModule(webBean);
Oracle Application Framework Training Manul OAF

if (pageContext.getParameter("item3")!=null)

am.getOADBTransaction().commit();

throw new OAException("Patient Data Entered Successfully",OAException.CONFIRMATION);

Now rebuild the code in the controller and also rebuild the code in the AM. After successfully rebuilding the
code run the page enter some date and click on Add button so that patient will be added.

The below figure shows the output of the page:


Oracle Application Framework Training Manul OAF

Creating Search Page


In this lesson we are going to see how to create the Search page according to the document.
According to the MD-050 document we need to create Manual Search Page. So let us see how to crate a
Manual search page step wise:

1. Create One new page on the project.


2. Attach AM to the project.
3. Design the page structure.

For example:
Oracle Application Framework Training Manul OAF

Page Name: SearchPG


Attached AM Name: xxstirling.oracle.apps.po.stirlingprj.webui

The below figure shows the page structure of the Search Page, which contains 3 message Text Input items for
searching and down one table layout region.

Here the search result will be displayed in table format so here we are adding images for update and detail of
the resultant rows in OAF page. The below picture shows the page structure of the search page:
Oracle Application Framework Training Manul OAF

The below figure shows the page structure output of the Search Page:

Still now we just created the page structure but the page is not yet validated properly.

After creating page structure we need to create the Method in AM for search operation, it means if we are
entering patient Id then in the where condition SQL Query must filter the Rows according to the entered Patient
Id related similarly for Patient Name and Patient Phone Number too.

So therefore we need to write a SQL data retrieval Query, create one VO and write the Query in the VO Qeury
area:

VO Name: SearchVO

Package Name: xxstirling.oracle.apps.po.stirlingprj.server

Write the Following Query in the query region of VO:


Oracle Application Framework Training Manul OAF

SELECT * FROM XXSTIRLING_PATIENT_ENTRY_TABLE

WHERE PATIENT_ID LIKE NVL(:1, PATIENT_ID)

AND PATIENT_NAME LIKE NVL(:2, PATIENT_NAME)

AND PHONE_NUMBER LIKE NVL(:3, PHONE_NUMBER)

After Creating VO attach VO to the AM. After attaching create method in AM, the following code shows the java
code of creating Method in AM.

public void xxSearchPatient (OAPageContext pc, OAWebBean wb)

{
String pid = null;
String name = null;
String phno = null;

SearchVOImpl vo1= getSearchVO1();

if (pc.getParameter("item1")!=null)
{
pid = pc.getParameter("item1").toString();
vo1.setWhereClauseParam(0,pid);
}
else
{
vo1.setWhereClauseParam(0,null);
}
if(pc.getParameter("item2")!=null)
{
name = pc.getParameter("item2").toString();
Oracle Application Framework Training Manul OAF

vo1.setWhereClauseParam(1,name);
}
else
{
vo1.setWhereClauseParam(1,null);
}
if(pc.getParameter("item3")!=null)
{
phno = pc.getParameter("item3").toString();
vo1.setWhereClauseParam(2,phno);
}
else
{
vo1.setWhereClauseParam(2,null);
}
vo1.executeQuery();
}

Create One controller in Search page and initialize the AM in the SearchPage Controller, note that we already
initialized AM in Patient Entry page Controller. Now we are initializing AM in SearchPage Controller, initialize the
AM in ProcessRequest as follows:

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

According to the page output we need to validate three buttons:

1. Search Button
2. Clear Button
3. Add New Patient.
Search Button, Clear Button, and Add New Patient buttons Validation code in Process Form Request is as
follows:

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

if(pageContext.getParameter("item4")!=null)
{
Oracle Application Framework Training Manul OAF

am.xxSearchPatient(pageContext,webBean);
}
else
if(pageContext.getParameter("item6")!=null)
{
OAMessageTextInputBean mstb = (OAMessageTextInputBean)webBean.findChildRecursive("item1");
mstb.setValue(pageContext,null);
OAMessageTextInputBean mstb1 = (OAMessageTextInputBean)webBean.findChildRecursive("item2");
mstb1.setValue(pageContext,null);
OAMessageTextInputBean mstb2 = (OAMessageTextInputBean)webBean.findChildRecursive("item3");
mstb2.setValue(pageContext,null);
}
else
if(pageContext.getParameter("item8")!=null)
{
pageContext.setForwardURL("OA.jsp?page=/xxstirling/oracle/apps/po/stirlingprj/webui/StrilingPG",
null,
OAWebBeanConstants.KEEP_MENU_CONTEXT,
null,
null,
true,
OAWebBeanConstants.ADD_BREAD_CRUMB_YES,
OAWebBeanConstants.IGNORE_MESSAGES);
}

Rebuild the code and run the page the below image shows the search page with results after clicking on Search
Button:
Oracle Application Framework Training Manul OAF

If we observe in the output we created two image items one is for Update and Other is for Details of the
patients. We not yet validated the Edit and Update images.

The next lesson shows how to create Update page and the page structure of the Update page and output of
Update, but for Update the values must be carried so hence we know that to carry values we will create SPEL
in OAF.

Creating Update Page

In this lesson we are going to see how to create Update page.

The update must contain the same details what we are entering while creating or adding patient, so there fore
the same page structure is required for us.
Oracle Application Framework Training Manul OAF

Create one page attach AM to the Page.

After creating the page go to the page structure of the Patient Entry page copy Region2 which is nothing but
Message Component Layout Region and simply paste it in the main region of search page.

After Copying the page structure we can see that same page structure is copied into the new update page
structure so that we can save some time rather than creating each item and changing the view instance and
view attribute and prompt names etc.,

If we observe we not yet created Update Button and after updating Patient details we need to go back to the
other main page, so for that another button need to be created.

Create two submit buttons with some space between the buttons looks good rather than placing them in
conjunction. So create one spacer item between region and one more spacer item between two submit buttons.
Oracle Application Framework Training Manul OAF

Finally the Update page structure looks like the following image:

Run the page to see the output and for the new created page also we need to attach corporate branding image.

The update page contains the details which are already entered so we just need to edit only few values or we
need to change only one or two changes like name is spelled wrong, amount entered is not correct or might be
refunded to the patient, etc.,

So therefore whenever on search page if we click on Update Image then it must take us to this update page
along with the details and after making changes we need to update the same row.

First let us write the code to validate the Update button and other button in the page.

Create the Controller in Update Page region, initialize the AM in the process Request of the controller:
Oracle Application Framework Training Manul OAF

StirlingAMImpl am = (StirlingAMImpl)pageContext.getApplicationModule(webBean);
am.xxinsertpatient();

Write the following code in processFormRequest, if you observe the code is similar code for update too like the
way we wrote for patient entry.

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

if (pageContext.getParameter("update")!=null)
{
am.getOADBTransaction().commit();
throw new OAException("Patient Data Updated Successfully",OAException.CONFIRMATION);
}

if(pageContext.getParameter("item4")!=null)
{
pageContext.setForwardURL("OA.jsp?page=/xxstirling/oracle/apps/po/stirlingprj/webui/StrilingPG",
null,
OAWebBeanConstants.KEEP_MENU_CONTEXT,
null,
null,
true,
OAWebBeanConstants.ADD_BREAD_CRUMB_YES,
OAWebBeanConstants.IGNORE_MESSAGES);
}

The below image shows the output of Update page.


Oracle Application Framework Training Manul OAF

Calling OAF Pages Using Update and Detail


Images

In the search page we have seen two images for each and every row result one is to Update the patient details

with image icon and another is for seeing the details and the image icon is .
Oracle Application Framework Training Manul OAF

Now we need to validate the image items in the result and whenever we click on these image items it must
take us to another page along with carrying the values too, so therefore we need to create SPEL for each image
item and then we have to write the code in processFormRequest of search page controller.

SPEL value of Update icon: ${oa.SearchVO1.PatientId}

Parameter Name of Update Icon: pid

SPEL value of Detail Icon: ${oa.SearchVO1.PatientId}

Parameter Name of Detail icon: ppatientid

Write the following code in ProcessFormRequest of search page controller, continuing the previous code

.....................

.....................

}
else
if("update".equals(pageContext.getParameter(EVENT_PARAM)))
{
pageContext.setForwardURL("OA.jsp?page=/xxstirling/oracle/apps/po/stirlingprj/webui/StirlingUpdatePG",
null,
OAWebBeanConstants.KEEP_MENU_CONTEXT,
null,
null,
true,
OAWebBeanConstants.ADD_BREAD_CRUMB_YES,
OAWebBeanConstants.IGNORE_MESSAGES);
}
else
if("detail".equals(pageContext.getParameter(EVENT_PARAM)))
{
pageContext.setForwardURL("OA.jsp?page=/xxstirling/oracle/apps/po/stirlingprj/webui/StrilingPG",
null,
Oracle Application Framework Training Manul OAF

OAWebBeanConstants.KEEP_MENU_CONTEXT,
null,
null,
true,
OAWebBeanConstants.ADD_BREAD_CRUMB_YES,
OAWebBeanConstants.IGNORE_MESSAGES);
}

Now the entire code in the controller class of Search page looks like the following:

public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)


{
super.processFormRequest(pageContext, webBean);

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

if(pageContext.getParameter("item4")!=null)
{
am.xxSearchPatient(pageContext,webBean);
}
else
if(pageContext.getParameter("item6")!=null)
{
OAMessageTextInputBean mstb = (OAMessageTextInputBean)webBean.findChildRecursive("item1");
mstb.setValue(pageContext,null);
OAMessageTextInputBean mstb1 = (OAMessageTextInputBean)webBean.findChildRecursive("item2");
mstb1.setValue(pageContext,null);
OAMessageTextInputBean mstb2 = (OAMessageTextInputBean)webBean.findChildRecursive("item3");
mstb2.setValue(pageContext,null);
}
else
Oracle Application Framework Training Manul OAF

if(pageContext.getParameter("item8")!=null)
{
pageContext.setForwardURL("OA.jsp?page=/xxstirling/oracle/apps/po/stirlingprj/webui/StrilingPG",
null,
OAWebBeanConstants.KEEP_MENU_CONTEXT,
null,
null,
true,
OAWebBeanConstants.ADD_BREAD_CRUMB_YES,
OAWebBeanConstants.IGNORE_MESSAGES);
}
else
if("update".equals(pageContext.getParameter(EVENT_PARAM)))
{
pageContext.setForwardURL("OA.jsp?page=/xxstirling/oracle/apps/po/stirlingprj/webui/StirlingUpdatePG",
null,
OAWebBeanConstants.KEEP_MENU_CONTEXT,
null,
null,
true,
OAWebBeanConstants.ADD_BREAD_CRUMB_YES,
OAWebBeanConstants.IGNORE_MESSAGES);
}
else
if("detail".equals(pageContext.getParameter(EVENT_PARAM)))
{
pageContext.setForwardURL("OA.jsp?page=/xxstirling/oracle/apps/po/stirlingprj/webui/StrilingPG",
null,
OAWebBeanConstants.KEEP_MENU_CONTEXT,
null,
null,
Oracle Application Framework Training Manul OAF

true,
OAWebBeanConstants.ADD_BREAD_CRUMB_YES,
OAWebBeanConstants.IGNORE_MESSAGES);
}

Final Code in AM, Update Page, and Patient


Entry Page Controller

There are few changes we need to made while calling or navigating from one form to another form.

So after all the final code in the Update page controller class looks like the following:

public void processRequest(OAPageContext pageContext, OAWebBean webBean)

{
super.processRequest(pageContext, webBean);

StirlingAMImpl am = (StirlingAMImpl)pageContext.getApplicationModule(webBean);
//am.xxinsertpatient();
if(pageContext.getParameter("pid")!=null)
{
String pid = pageContext.getParameter("pid").toString();
String whereclause = "PATIENT_ID='"+pid+"'";
am.getPatientEntryVO1().setWhereClause(null);
am.getPatientEntryVO1().setWhereClause(whereclause);
am.getPatientEntryVO1().executeQuery();
}
else
{
Oracle Application Framework Training Manul OAF

am.xxinsertpatient();
}
OAMessageRadioButtonBean var1 = (OAMessageRadioButtonBean)webBean.findChildRecursive("male");
var1.setName("Gender");
var1.setValue("Male");

OAMessageRadioButtonBean var2 = (OAMessageRadioButtonBean)webBean.findChildRecursive("female");


var2.setName("Gender");
var2.setValue("Female");
}

/**
* Procedure to handle form submissions for form elements in
* a region.
* @param pageContext the current OA page context
* @param webBean the web bean corresponding to the region
*/
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processFormRequest(pageContext, webBean);

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


// am.xxinsertpatient();
if (pageContext.getParameter("update")!=null)
{
am.getOADBTransaction().commit();
throw new OAException("Patient Data Updated Successfully",OAException.CONFIRMATION);
}

if(pageContext.getParameter("item4")!=null)
{
Oracle Application Framework Training Manul OAF

pageContext.setForwardURL("OA.jsp?page=/xxstirling/oracle/apps/po/stirlingprj/webui/StrilingPG",
null,
OAWebBeanConstants.KEEP_MENU_CONTEXT,
null,
null,
true,
OAWebBeanConstants.ADD_BREAD_CRUMB_YES,
OAWebBeanConstants.IGNORE_MESSAGES);
}
}

The above code is the Controller class code in Update Page.

Let us see the Patient Entry page controller code:

public void processRequest(OAPageContext pageContext, OAWebBean webBean)


{
super.processRequest(pageContext, webBean);

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

if(pageContext.getParameter("ppatientid")!=null)
{
String pid = pageContext.getParameter("ppatientid").toString();
String whereclause = "PATIENT_ID='"+pid+"'";
am.getPatientEntryVO1().setWhereClause(null);
am.getPatientEntryVO1().setWhereClause(whereclause);
am.getPatientEntryVO1().executeQuery();
}
else
{
am.xxinsertpatient();
Oracle Application Framework Training Manul OAF

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


var1.setName("Gender");
var1.setValue("Male");

OAMessageRadioButtonBean var2 = (OAMessageRadioButtonBean)webBean.findChildRecursive("female");


var2.setName("Gender");
var2.setValue("Female");

/**
* Procedure to handle form submissions for form elements in
* a region.
* @param pageContext the current OA page context
* @param webBean the web bean corresponding to the region
*/
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processFormRequest(pageContext, webBean);

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

if (pageContext.getParameter("item3")!=null)
{
System.out.println("Add button called");
am.getOADBTransaction().commit();
throw new OAException("Patient Data Entered Successfully",OAException.CONFIRMATION);
}
if(pageContext.getParameter("item9")!=null)
Oracle Application Framework Training Manul OAF

{
pageContext.setForwardURL("OA.jsp?page=/xxstirling/oracle/apps/po/stirlingprj/webui/SearchPG",
null,
OAWebBeanConstants.KEEP_MENU_CONTEXT,
null,
null,
true,
OAWebBeanConstants.ADD_BREAD_CRUMB_YES,
OAWebBeanConstants.IGNORE_MESSAGES);
}
else
if (pageContext.getParameter("item11")!=null)
{
pageContext.setForwardURL("OA.jsp?page=/xxstirling/oracle/apps/po/stirlingprj/webui/StrilingPG",
null,
OAWebBeanConstants.KEEP_MENU_CONTEXT,
null,
null,
true,
OAWebBeanConstants.ADD_BREAD_CRUMB_YES,
OAWebBeanConstants.IGNORE_MESSAGES);
}
}

The code below is the code is the AM Java code, and note that we created only one AM for the entire project.
We created two methods overall in AM and the below code shows the two methods:

public void xxinsertpatient()

{
PatientEntryVOImpl vo= getPatientEntryVO1();
OADBTransaction trans= getOADBTransaction();
Oracle Application Framework Training Manul OAF

vo.executeQuery();
Row v_row = (Row)vo.createRow();
vo.insertRow(v_row);
}

public void xxSearchPatient (OAPageContext pc, OAWebBean wb)


{
String pid = null;
String name = null;
String phno = null;
//OAViewObject vo= getSearchVO1();
SearchVOImpl vo1= getSearchVO1();
if (pc.getParameter("item1")!=null)
{
pid = pc.getParameter("item1").toString();
vo1.setWhereClauseParam(0,pid);
}
else
{
vo1.setWhereClauseParam(0,null);
}
if(pc.getParameter("item2")!=null)
{
name = pc.getParameter("item2").toString();
vo1.setWhereClauseParam(1,name);
}
else
{
vo1.setWhereClauseParam(1,null);
}
if(pc.getParameter("item3")!=null)
Oracle Application Framework Training Manul OAF

{
phno = pc.getParameter("item3").toString();
vo1.setWhereClauseParam(2,phno);
}
else
{
vo1.setWhereClauseParam(2,null);
}
vo1.executeQuery();
}

Dynamic Changes in OAF pages

In this lesson we are going to see how to change the same page behavior dynamically.

For example in our project if we look at the functionality whenever we click on the Detail page all the patient
details are showing but all are showing in Editable format and moreover the add button is also in active stage
whenever we click on Detail image in search page.

So therefore here our requirement and our task is whenever we click on Detail logo all the items and data must
be only in Read only stage and also the Add button must be in Disable mode.

To achieve these dynamic change in OAF pages follow the steps:

1. Edit the Patient Entry page VO.


2. Create one transient attribute in the VO.

Transient attribute in OAF is nothing but the attribute value which is not in the Oracle Data Base table. We
know that while creating VO all the Columns of table will be converted into Attributes or we call columns as
attributes in VO, so therefore transient attribute is one which we create temporarily to display some results
which will not effect data base tables.

For example Student marks are saved in different columns but in data base assume that we are not
maintaining any column for total marks sum but if we want the total value to be displayed in OAF form so
therefore for that we will create on temporary or duplicate attribute value to hold total marks.

Let us see how to create transient attribute in OAF according to our requirement:

Edit the VO as shown in the below figure:


Oracle Application Framework Training Manul OAF

Right click on VO and select Edit PatientEntryVO or double click on the VO to open it.

After opening the VO select the Attributes value in left side as shown in the below figure:
Oracle Application Framework Training Manul OAF

Select New button which is located down to the attributes list, After selecting New button give new attribute
name, Type as Boolean, and in Updatable select a Radio Button option called Always, for example see the
below picture:
Oracle Application Framework Training Manul OAF

Click on Ok button later click on Apply and Ok button in View Object so that the transient attribute will be
created.

After creating transient attribute now create one SPEL value basing on patient entry vo, because we need to do
dynamic changes in this page only:
${oa.PatientEntryVO1.xxReadOnly}
After creating SPEL pass this SPEL value in each and every item of a Patient Entry page region, pass the SPEL
value to all the items those we want them to act as a read only values, note that we cannot pass this SPEL
value directly to region because of that reason we have to pass in each item, now the question rises where to
pass SPEL value:
Pass the SPEL value in :
-> Select XML page and in page structure select the item.
-> In the property inspector Functional -> Read Only, here we will find True and False.
-> Remove the current existing True/False value and place the SPEL value which we created here.
pass the SPEL values to all the items and even to ADD button item.
After adding the SPEL value go to AM and add the following additional line in the AM method which we created
to add patient as follows:
public void xxinsertpatient()
{
PatientEntryVOImpl vo= getPatientEntryVO1();
OADBTransaction trans= getOADBTransaction();
vo.executeQuery();
Oracle Application Framework Training Manul OAF

Row v_row = (Row)vo.createRow();


vo.insertRow(v_row);

//the below one is the additional line code

v_row.setAttribute("xxReadOnly",Boolean.FALSE);
}

In the Controller class add the following code, in code “ppatientid” is the parameter value of detail icon which
we already seen in the previous lessons so additionally we are adding three lines which are:

if(pageContext.getParameter("ppatientid")!=null)

{
String pid = pageContext.getParameter("ppatientid").toString();
String whereclause = "PATIENT_ID='"+pid+"'";
am.getPatientEntryVO1().setWhereClause(null);
am.getPatientEntryVO1().setWhereClause(whereclause);
am.getPatientEntryVO1().executeQuery();

// add the following lines

OAViewObject vo=(OAViewObject)am.findViewObject("PatientEntryVO1"); Row row= vo.first();


row.setAttribute("xxReadOnly",Boolean.TRUE);
}

Rebuild the code and run the page and see the output, the below figure shows the search page output and the
second image shows the dynamically changed page which is actually the patient entry page:
Oracle Application Framework Training Manul OAF

Click on Detail Image icon in the search list:


Oracle Application Framework Training Manul OAF

Chapter 10: Deploying OAF Pages Into Oracle


Apps
Moving OAF Project Files Into Apps Server

This lesson shows how to move OAF project files into Apps Server, or OAF deployment, or Registering OAF
pages in to Oracle Applications.

Here we are going to see how to move the files into the APPS server.

To move files from Desk top system to Oracle Apps server we need to use third Party tools like Putty, WinScp,
etc..

Here we are using both Putty and Winscp, and let us see how to register OAF page into Apps Server.

Step 1: Move all Class files or Java files to respective JAVA_TOP.


If we are moving Java files then we need to compile Java files explicitly in the server using the command
Oracle Application Framework Training Manul OAF

JAVAC <Java_file_name.java>
If we are moving Class files then the compilation is not required, i.e., instead of compilation we can move class
files directly.

Note: The best approach is to move java files into server and compile, so that server side compatibility will be
there.

In linux environment to know where exactly the JAVA_TOP is located type the following command in putty:

cd $JAVA_TOP
after changing the directory type the following command so that we will come to know the path location where
exactly the JAVA_TOP is located:

pwd (Present working Directory)


example:

/u01/apps1/apps/apps_st/comn/java/classes

Step 2: After finding where exactly the Java top is located move the files into java top, let us see how to move
class files, here we are moving class files to the JAVA_TOP using the WinScp
The below image shows the moving process in WinScp

Drag the folder from left side and drop it on the linux/unix environment:
Oracle Application Framework Training Manul OAF

Select the folder drag and drop it to the server environment, after that one popup window will come and click
on Copy button:

In the next lesson we are going to see Import script, and why we need import script.
Oracle Application Framework Training Manul OAF

Import Script in OAF

In this lesson we are going to see the import script in OAF and how to use import script in oaf.

The importance of OAF import script is for redirection of pages into MDS directory.

Let us consider in our project we have one OAF page with the following page link generated:

OA.jsp?page=/xxstirling/oracle/apps/po/stirlingprj/webui/SearchPG

so for the above search page see the following import script which we need to perform in putty:

java oracle.jrad.tools.xml.importer.XMLImporter
$JAVA_TOP/xxstirling/oracle/apps/po/stirlingprj/webui/SearchPG.xml -username apps -password apps -dbconnection
"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcp)(HOST=www.newtonapples.com)(PORT=1521
)))(CONNECT_DATA=(SERVICE_NAME=vis)))" -rootdir $JAVA_TOP

the above import script is for linux/unix environment but few students might practice in Windows server
environment for them the following is the import script for window server environment:

import
D:\Bharath\Softwares\p9879989_R12_GENERIC\jdevhome\jdev\myprojects\xxstirling\oracle\apps\po\stirlingprj\webui\
SearchPG.xml -rootdir ...(your win server apps rootdir)..\jdevhome\jdev\myprojects -username apps -password apps -
dbconnection
"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcp)(HOST=www.newtonapples.com)(PORT=1521
)))(CONNECT_DATA=(SERVICE_NAME=vis)))"

For each and every page we need to execute the import script in OAF, the below image shows import script
execution process i.e., after writing the import script the following is the confirmation it shows in putty:

Whenever the import script is executed successfully i.e., if the importing file is properly executed then it shows
a message called “Import Completed”.
Oracle Application Framework Training Manul OAF

In the next lesson we are going to see how to create function, creating menu, and attaching menu to
Responsibility.

Creating Function,Menu, and Responsibility in


Apps for OAF Pages

In this lesson we are going to see how to create a function,menu, and responsibility in Oracle Applications for
OAF pages.

Creating Function in Apps


Select Application Developer or System Administrator to navigate to Function, The below image shows the
navigation in System Administrator.
Oracle Application Framework Training Manul OAF

After selection, then a Function window will get opens, give the Function Name and User Function Name
Oracle Application Framework Training Manul OAF

After that go to Properties tab and in that give Type as SSWA jsp function
Oracle Application Framework Training Manul OAF

After that go to Web Html tab and in that in HTML call give the address bar generated page path don’t give
.xml extension.

Save it and then navigate to create Menu


Oracle Application Framework Training Manul OAF

Give Menu name and function Name, if we want to create Submenus then create one more menu add function
to that and design the menu structure according to the Oracle Applications guidance.
Oracle Application Framework Training Manul OAF

After that create one responsibility (optional) add menu to that responsibility, the below image shows the
responsibility navigation in System Administrator:
Oracle Application Framework Training Manul OAF

Give the values in Responsibility, for example see the below image:
Oracle Application Framework Training Manul OAF

After adding menu to the responsibility attach Responsibility to the User, Bounce the Server.

Clear the Cache using Functional Administrator which is Optional.

The below image shows the example navigation of the Responsibility which contains two sub menus under one
main menu.
Oracle Application Framework Training Manul OAF

Вам также может понравиться