Professional Documents
Culture Documents
Oracle Application Framework Training Material
Oracle Application Framework Training Material
Training Material
TABLE OF CONTENTS
DOCUMENT USAGE...................................................................................................................4
DETAILS OF DOCUMENT.........................................................................................................4
1 OAF ARCHITECTURE .............................................................................................................4
1.1 ABOUT MODEL ...........................................................................................................................5
1.2 ABOUT VIEW .............................................................................................................................5
1.3 ABOUT CONTROLLER ...................................................................................................................5
2. KEY FEATURES .............................................................................................................................6
2.1 INTEGRATED DEVELOPMENT ENVIRONMENT (IDE) ..........................................................................6
2.2 DURABLE PERSONALIZATIONS AND EXTENSIONS ...............................................................................6
2.3 CONSISTENT AND COMPELLING USER INTERFACE .............................................................................6
2.4 OBJECT ORIENTED REUSE ............................................................................................................7
3. OA FRAMEWORK ESSENTIALS ........................................................................................................7
4. IMPLEMENT THE MODEL IN OAF ................................................................................................9
5. IMPLEMENT THE VIEW IN OAF.............................................................................................11
6. IMPLEMENT THE CONTROLLER IN OAF ..................................................................................12
7. OAF KEY DO'S AND DON'TS (PART 1) - "TOP 10" GOLDEN RULES.................................................13
8. PRACTICAL PROBLEMS AND SOLUTIONS ..........................................................................................20
Display the message as “Welcome <text item value>” on the OAF page when you
press the “Go” button.............................................................................................................20
Product Branding: ................................................................................................................23
In-Context Branding: ............................................................................................................24
How do display default string in Text Item when page is rendered.........................................26
How do hide Text item at runtime...........................................................................................26
How do disable the button at runtime.....................................................................................26
How do display message in different colour...........................................................................27
How do call the specified page from another page.................................................................27
How do display the Return Navigation link on the page.........................................................28
How do add a returnLink dynamically....................................................................................30
Connect to Database and return number of suppliers on the page..........................................30
How do call stored procedure from OAF page (Without using EO, VO).................................31
Display message by using AOL Message Name (Message Dictionary)...................................32
How do call D2K Form from OAF page.................................................................................33
Implement a Search Page.......................................................................................................33
How do display the drill down to details page according to criteria.......................................39
How do display custom copy right on OAF page....................................................................41
How do get the value of the checkbox when selected or deselected........................................41
How do insert data from OAF Page to Database table by using View Object ........................41
How do refresh the same page after the data has been entered...............................................44
How do set the values in poplist.............................................................................................44
How do hide the specified item when user selects the particular value from Poplist...............45
How do fire event? To display supplier name according to supplier id...................................48
How do create list box and add values to the list box dynamically..........................................49
Create a Shuttle Region..........................................................................................................50
About StackLayout, rowLayout, cellFormat region styles.......................................................52
About Browser Look and Feel (BLAF)...................................................................................53
About AdvancedTable Bean....................................................................................................55
OAF Training
Page 3 of 67
OAF Training
Document Usage
This document can be used to develop self service web pages. The developer can know from basic
points to advanced points in OAF. This document is like a useful reference guide.
Details of Document
1 OAF ARCHITECTURE
The MVC architecture is a component-based design pattern with clean interfaces between
the Model, View and Controller.
The Controller is where the application handles user interaction and directs business flow.
Find the following MVC diagram to understand relationship between Model, View and
Controller.
Page 4 of 67
OAF Training
The metadata used to describe the UI is loaded into a database repository, called Meta Data
Services (MDS), at deployment time and optionally at design time as well.
Page 5 of 67
OAF Training
2. Key Features
• Integrated Development Environment
• Durable Personalizations and Extensions
• Consistent and Compelling User Interface
• Object Oriented Reuse
Extensibility is about extending the functionality of an application beyond what can be done
through personalization.
Examples:
• Adding new functional flows
• Extending or overriding existing functional flows
• Extending or overriding existing business logic
OA Framework user interface components range from simple widgets such as buttons and
fields to compound components such as tables-in-tables and hierarchical grids.
Page 6 of 67
OAF Training
On User Interface Side, reusable components can be saved as Shared regions in the MDS
repository and reused across several pages.
3. OA Framework Essentials
Key JSP Application Components
1)
The Browser communicates with the middle tier using HTTP which involves sending a
request message to which the middle tier replies with a response message.
2)
A JSP is a file with some HTML and JAVA code that executes top to bottom. At runtime, it is
compiled into a Java class which is actually a Servlet.
3)
A Servlet is a Java web based application server extension program that implements a
Standard API.
4)
Page 7 of 67
OAF Training
A Servlet Session is a mechanism for maintaining state between HTTP requests during a
period of continuous interaction between Browser and Web Application. A Session may be
initiated at any time by the application and terminated by the application, by the user closing
the browser, or by a period of inactivity.
A session usually corresponds to an application login/logout cycle.
5)
A JavaBean (“Bean” for short) is simply a reusable component that implements specific
design patterns to make it easy for programmers and development tools to discover the
object’s properties and behavior.
6)
Any objects in the middle tier that communicate with the database use a JDBC (Java
DataBase Connectivity).
Page 8 of 67
OAF Training
This chapter describes how to implement your model objects in generic terms.
All BC4J (Business components for Java) model components must belong to a Business
Components Package.
1) Entity Object
Entity Objects encapsulate business logic and DML operations for application tables.
There is a one-to-one mapping between a table and an entity object, and all Oracle
Applications entity objects should include all columns in their associated tables.
Entity objects use a declarative mapping between their attributes and underlying database
columns to automatically implement queries, inserts, updates and deletes.
Page 9 of 67
OAF Training
2) View Objects
Example: i) EmployeeNamesVO.xml
ii) EmployeeNamesVOImpl.java
iii) EmployeeNamesVORowImpl.java
3) Association Objects
Association object is used to create relationship between Entity objects. There are two
types of associations are given below.
1) Composition (Strong association)
2) Reference (Weak association)
Composition: - The destination entity object can not exist independent of its source entity
object.
Example: A purchase order header is automatically locked even if you make changes only
to its lines. Child is deleted when parent is deleted.
Reference: - The source entity object simply references the destination object.
Example: A purchase order header references a supplier, but the supplier can still exist
regardless of whether a purchase order references it or not.
4) Application Modules
Page 10 of 67
OAF Training
At development time, you specify the bean hierarchy for every page using the JDeveloper
tool.
Items are simple widgets like buttons, images, fields and so on which contain no children.
Regions are container objects that hold items and other regions. Regions include header,
table and layout components.
Each region and item that you define has a style property that tells the OA Framework what
web bean object to instantiate for it at runtime. For example, if you define a region whose
style property is "table," the OA Framework will instantiate an
oracle.apps.fnd.framework.webui.beans.table.OATableBean
All pages must have a single top-level region whose style is “PageLayout”. Regions and
Items appear in JDeveloper page tree in sequence that tells Framework where to add these
objects to runtime bean hierarchy.
Page 11 of 67
OAF Training
CONTROLLER is used to enhance OA Framework page using logic for buttons, automatic
queries, dynamic WHERE clauses, JSP forwards, and the Message Dictionary.
Page 12 of 67
OAF Training
We could not call methods of Entity Objects (EO) from Controller directly. We have to follow
below order to call method from location to other location.
7. OAF Key Do's and Don'ts (Part 1) - "Top 10" Golden Rules
I don't know how many of you have come across this in the OAF Devguide, it was only by
change that I found it, thought I'd share:
There's a lot to learn when getting started with the OA Framework, but the following list of
rules are so universal -- and so fundamental -- they should be familiar to anyone who's doing
Framework development.
1) ALWAYS try to declaratively define your UI. Resort to a programmatic layout only if the UI
cannot be implemented declaratively. Programmatic layouts are difficult to customize (they
don't leverage the Personalization Framework) and may diverge from the UI Guidelines over
time.
3) NEVER use index numbers to find beans when you want to change their properties.
ALWAYS search by name. Index numbers can change during processing.
4) NEVER change the properties of a parent bean from a child bean. This is a poor design
practice that hampers reuse while introducing fragile code (particularly if the child code
executes too late in the page rendering cycle to properly affect the parent).
5) NEVER instantiate Beans using "new OA Bean()". ALWAYS use the createWebBean()
factory methods available on the OAControllerImpl class. Not all Bean properties are
initialized correctly when you use "new."
6) NEVER create Form Beans in code (this means NEVER add nested Form beans to a
page; your Page Layout region should be the only form region). Multiple form Beans on a
page are not supported and can result in strange runtime behaviors.
7) NEVER count on your Application Module using the same database connection in
subsequent requests. For example, NEVER post and commit in separate requests. For
performance reasons, the Framework will start pooling and reusing connections in 5.7
instead of holding onto a single connection throughout the life of an Application Module.
Page 13 of 67
OAF Training
8) NEVER use JDBC directly unless you're calling a PL/SQL routine (you should use a view
object instead, and if possible, the view object should be defined declaratively and not
programmatically).
9) NEVER add member variables UNLESS THEY ARE TRANSIENT OR FINAL to view
objects, Controllers, entity object, view rows and Application Modules.
Page 14 of 67
OAF Training
Navigation: - right click on Workspaces option in system-navigator Window and select New
OAWorkspace
Note: If you do not have .dbc file, then import the .dbc file from server
($ cd %APPL_TOP/fnd/11.5.0/secure/.dbc) and place in above path in your local
system.
Page 15 of 67
OAF Training
New window will be opened, and then select “WebTier” under “categories” list.
Select “OA Components” option under “Web Tier” and select “Page” right side.
Page 16 of 67
OAF Training
Press OK Button.
You can change the package name if you want otherwise leave it as it is because the
package is already created at the time of workspace creation.
Page 17 of 67
OAF Training
Now, we will run the .xml (WelcomePG.xml) to render the OAF page on the Browser.
In above diagram, there is “region1” called root region. It is container, consists items
and other regions.
Set the properties for root region (region1) in property inspector window.
Select “MainRN” and click right mouse button, select “region” Option and set the
below properties.
Property Name Value
ID SubRN
Region Style Messagecomponentlayout
Select the region “SubRN” and click right mouse button, and then select the option
“messageTextInput” and set the below properties.
Page 18 of 67
OAF Training
Page 19 of 67
OAF Training
See the below OAF page screenshot and verify the window title, page title and text item
prompt with above properties.
Window Title of Root Region MainRN
Page Title of
Root Region
(MainRN)
In this stage, there is no control on the OAF page. We have to create CONTROLLER on the
root region and write the code to control the OAF page.
Select the region “ButtonLayout” and click right mouse button, and select the
Option “item”.
Page 20 of 67
OAF Training
After press the OK button, one .java file will be created with “Controller” name as
WelcomeCO.java
See below screenshot:-
See below screenshot once and observe the methods “processRequest” and
“processFormRequest” in the Java file (WelcomeCO.java).
Page 21 of 67
OAF Training
When press the “Go” button, the button related code will be executed from
“processFormRequest” method (like Java POST method).
The “processRequest” code will be executed at the time of initializing the page.
Logic to display the message “Welcome <value of text item> on OAF page. Add below code
in the method “processFormRequest”.
Code:
if (pageContext.getParameter("Go")!=null)
{
String str=pageContext.getParameter("WelcomeTxt");
String message="Welcome "+str;
throw new OAException(message,OAException.INFORMATION);
}
In above code, “Go” is button name (not prompt) which is used in “if” condition.
“WelcomeTxt” is also text item id (not prompt).
When user press the “Go” button, the browser will send the request to middle tier and after
processing the middle tier responds to browser.
Page 22 of 67
OAF Training
The OAException class is used to display the message on the OAF page. The second
parameter is exception type “INFORMATION”.
Note: The exception types “ERROR” and” SEVERE” terminate the program.
Now, run the page “WelcomePG.xml” and see output like below.
Output: Enter the text “OAF students” in text item and press the “Go” button, then display
the message on “MainRN” (Root region).
• Product Branding:
The “productBranding” is used to place image beside corporate branding image “ORACLE”.
Select “pageLayout components” and click right mouse button, and select the
productBranding option.
Page 23 of 67
OAF Training
Set the system profile “FND: Branding Size” as “Medium” at site level.
If you change menus or profile values etc, then we have to terminate the OAF page.
Navigation: RUN->Terminate->Embedded OC4J Server (Menu bar)
Compile and run the OAF page (.xml), check the output from below screenshot.
• In-Context Branding:
The in-context branding includes corporate branding and product branding images.
Additionally, contextual information renders below corporate and product branding images.
Select “pageLayout Components” region and click right mouse button, then select the
“InContextBranding” option.
Page 24 of 67
OAF Training
Set the properties for “productBranding” item style as “formattedText” and enter Text
property as “Sales Online”.
We can use html tags to change font styles or display font in bold etc.
Output:
Page 25 of 67
OAF Training
Code:
OAMessageTextInputBean fieldHelloTxt=
(OAMessageTextInputBean)webBean.findChildRecursive(“WelcomeTxt”);
Where “WelcomeTxt” is a Text Item ID. Write above code in “processRequest” method of
CONTROLLER.
Important Note:
We have to import the class “OAMessageTextInputBean”.
import oracle.apps.fnd.framework.webui.beans.message.
OAMessageTextInputBean;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
Code:
The Method “setRendered” is used to hide the text item. Pass the value “false” for this
method.
import oracle.apps.fnd.framework.webui.beans.message.
OAMessageTextInpuBean;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
OAMessageTextInputBean hellotxt=
(OAMessageTextInputBean)webBean.findChildRecursive(“WelcomeTxt”);
Hellotxt.setRendered(false);
Like setRendered method, there are so many methods are available in text item Bean.
Page 26 of 67
OAF Training
Code:
We have to use “OASubmitButtonBean” to change behavior of buttons at runtime.
import oracle.apps.fnd.framework.webui.beans.form.OASubmitButtonBean;
OASubmitButtonBean goButton =
(OASubmitButtonBean)webBean.findChildRecursive("Go");
goButton.setDisabled(true);
I have two pages. One page is security page, if user enters the login details correct then
open the other specific page.
Solution:
The API pageContext.SetForwardURL is used to open the other specific page.
Design the security page with two text items and one button like below screen shot.
(Note: This is not related to database. Just check the user name and password with static
text like username=Venky and password=Venky)
Code:
(Write in Controller – processFormRequest Method)
if (uname.equals("Venky")&&pwd.equals("Venky"))
Page 27 of 67
OAF Training
{ pageContext.setForwardURL("OA.jsp?
page=/train/oracle/apps/ak/welcome/webui/WelcomePG",
null,
OAWebBeanConstants.KEEP_MENU_CONTEXT,
null,
null,
true,
OWebBeanConstants.ADD_BREAD_CRUMB_YES,
OAWebBeanConstants.IGNORE_MESSAGES);
}
Enter user name and password correct, and then press “Go” button.
Note: Set text item property “secret” as True when enter password. User could not
see the password while entering.
The below page “WelcomePG” will be opened.
Suppose, if user call second page from first page and perform some actions on the second
page. Later, the user wants to go back to first page, then we have to use “Return Navigation”
link.
Select the region “pageLayoutRN” and click right mouse button, and then select the option
“returnNavigation”.
Page 28 of 67
OAF Training
Page 29 of 67
OAF Training
When user presses the “Return to Security Page” link, then the security page will be
opened.
((OAPageLayoutBean)webBean).setReturnNavigation(returnLink);
import oracle.apps.fnd.framework.webui.OAWebBeanConstants;
import oracle.apps.fnd.framework.server.OADBTransaction;
import java.sql.*;
Write below code in process request() method or anywhere as per requirement.
oracle.apps.fnd.framework.OAApplicationModule am =
pageContext.getApplicationModule(webBean);
Page 30 of 67
OAF Training
int task2Type = 0;
Connection conn = am.getOADBTransaction().getJdbcConnection();
try{
psProType = conn.prepareStatement(task2Info);
rsProType = psProType.executeQuery();
if (rsProType.next())
{
task2Type = rsProType.getInt(1);
}
} catch(Exception e) {pageContext.writeDiagnostics(am,e.getMessage(),4);}
• How do call stored procedure from OAF page (Without using EO, VO)
Code:
Place the button “Callable” and write above code in processFormRequest method
import java.sql.Connection;
import oracle.jdbc.OracleCallableStatement;
if (pageContext.getParameter("Callable")!=null)
{
try
{
String deleteStmt = "BEGIN DELETE_RECORD( " +
"PARAM1 => :1); END; ";
OADBTransaction trxn = am.getOADBTransaction();
Page 31 of 67
OAF Training
CallableStatement delproc =
trxn. createCallableStatement(deleteStmt,1) ;
// Rebind parameters
delproc.setString(1,"rahul");
delproc.executeUpdate();
} catch(Exception sqle)
{
pageContext.writeDiagnostics(am, sqle.getMessage(), 4);
}
//CallableStatement deleteSt=conn.prepareCall(deleteStmt);
}
Page 32 of 67
OAF Training
Code:
pageContext.forwardImmediatelyToForm("form:PO:PURCHASING_OPERATIONS:STANDA
RD:PO_POXPOEPO");
Result:
Write above code in controller for button. Opens the PO Form when click the button.
1) Create project
2) Create Business Component Package “train.oracle.apps.ak.empsearch.server”
3) Create Entity object (EO) under the above package.
4) Create Application Module (AM) under the package
“train.oracle.apps.ak.empsearch.server”
Application Module Name: EmployeeAM
5) Create an Employee-to-Manager Association (AO) for the self- join condition on the
“FWK_TBX_EMPLOYEE” table.
Page 33 of 67
OAF Training
6) Select “Manager Id” in source table and Select “EmployeeId” in Destination table.
Page 34 of 67
OAF Training
Create ViewObject (VO) to display the data on the page. Here, VO is based on EO.
Page 35 of 67
OAF Training
Select “EmpSearchEO” object twice. There are two entity objects and linked the two Eos
through Association Object (AO).
10) Select Next button, and select attributes from EmpSearchEO and EmpSearchEO1.
11)
Select below columns from EmpSearchEO and EmpSearchEO1.
o EmployeeId
o FullName
o EmailAddress
12) Changes attribute name and alias as meaningful.
Page 36 of 67
OAF Training
Select Next button, and observer Query. We can change query, if you select the check box
“Expert Mode”.
13) Now, I want to include some other condition in the above query.
QUERY:
SELECT EmpSearchEO.EMPLOYEE_ID,
EmpSearchEO.FULL_NAME AS EMPLOYEE_NAME,
EmpSearchEO.EMAIL_ADDRESS AS EMPLOYEE_EMAIL,
EmpSearchEO1.EMPLOYEE_ID AS MANAGER_ID,
EmpSearchEO1.FULL_NAME AS MANAGER_NAME,
EmpSearchEO1.EMAIL_ADDRESS AS MANAGER_EMAIL,
Flkp.meaning POSITION_DISPLAY
FROM FWK_TBX_EMPLOYEES EmpSearchEO,
FWK_TBX_EMPLOYEES EmpSearchEO1,
FWK_TBX_LOOKUP_CODES_VL flkp
WHERE EmpSearchEO.MANAGER_ID = EmpSearchEO1.EMPLOYEE_ID(+)
AND EmpSearchEO.POSITION_CODE=flkp.lookup_code
AND flkp.lookup_type=’FWK_TBX_POSITIONS’
Select Next button, and check mapping between Query Columns and Attribute names.
Select Finish button.
Page 37 of 67
OAF Training
15) Select the application module (already created), and press right mouse button and
select the option “Edit EmpSearchAM”, then select the “ViewObject”.
Page 38 of 67
OAF Training
Page 39 of 67
OAF Training
Code:
import oracle.jbo.domain.Number;
import oracle.apps.fnd.framework.OAException;
public void initQuery(String employeeNumber)
{
If (employeeNumber! =null)
{
Number empNum=null;
Try
{
empNum=new Number(employeeNumber);
}
Catch(Exception e)
{
Throw new OAException(“AK”,” FWK_TBX_INVALID_EMP_NUMBER”);
}
setWhereClause(“EMPLOYEE_ID=:1”);
setWhereClauseParams(null);
setWhereClauseParam(0,empNum);
executeQuery();
}
}
Code:
String empnum=pageContext.getParameter(“employeeNumber”);
OAApplicationModule am=pageContext.getApplicationModule(webBean);
Serializable[] parameters={empnum};
Am.invokeMethod(“initDetails”, parameters);
Page 40 of 67
OAF Training
Solution:
First, we have set the pageLayout region property “AutoFooter” as False. (This is very
important).
Select the pageLayout region, and press right mouse button, then select the option
“Copyright” and set the property “prompt” as you wish.
Run the page and observe the “Copyright” prompt at footer of the page.
Code:
http://forums.oracle.com/forums/thread.jspa?threadID=577666&start=0&tstart=165
In this site, code has been given regarding get value of selected checkbox from VO
(Displayed multiple rows)
• How do insert data from OAF Page to Database table by using View Object
Steps
1) Create view object with query.
2) Create application module and attach the view object
3) Create OAF page and attach application module.
4) Create Controller and write below code.
import oracle.apps.fnd.framework.OAApplicationModule;
Page 41 of 67
OAF Training
import oracle.apps.fnd.framework.webui.beans.message.OAMessageTextInputBean;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageLovInputBean;
import java.text.SimpleDateFormat;
import java.text.DateFormat;
import java.util.Date;
import java.text.ParseException;
import oracle.apps.fnd.framework.server.OADBTransaction;
import java.sql.*;
Method: processRequest ()
**********************************
Method: processFormRequest ()
****************************************
if (pageContext.getParameter("Apply")!=null)
{
try
{
OAApplicationModule am=pageContext.getApplicationModule(webBean);
// Date update_date=pageContext.getCurrentUserDate();
// System.out.println("current date="+update_date);
OAMessageTextInputBean supplier_id =
(OAMessageTextInputBean)webBean.findChildRecursive("SupplierId");
String sup_id_txt=supplier_id.getText(pageContext);
int sup_id=Integer.parseInt(sup_id_txt);
OAMessageLovInputBean sup_name =
(OAMessageLovInputBean)webBean.findChildRecursive("SupplierName");
String supname_txt=sup_name.getText(pageContext);
OAMessageTextInputBean onhold_flag =
(OAMessageTextInputBean)webBean.findChildRecursive("OnHoldFlag");
String onhold_txt=onhold_flag.getText(pageContext);
String sdate=pageContext.getParameter("StartDate");
// Date startdate_txt=sdate;
//System.out.println("start date="+df.format(startdate_txt));
String edate=pageContext.getParameter("EndtDate");
// Insert row into the table FWK_TBX_SUPPLIERS
String task2Info = null;
Page 42 of 67
OAF Training
psProType = conn.prepareStatement(task2Info);
psProType.setInt(1,sup_id);
psProType.setString(2,supname_txt);
psProType.setString(3,onhold_txt);
psProType.setString(4,sdate);
psProType.setString(5,edate);
// psProType.setString();
psProType.executeUpdate();
am.invokeMethod("apply");
}
catch(Exception e)
{
System.out.println("error="+e.getMessage());
}
//psProType.setDate(4,startdate_txt);
// psProType.setDate(5,edate);
}
}
// it is used to create row in view object cache, and then user can enter and insert
data into table.
// it is for commit the transaction; otherwise not inserted the record into table.
public void apply()
{
getTransaction().commit();
}
Please find the below screen shot. The below data will be inserted into table when press
the “Apply” button.
Page 43 of 67
OAF Training
• How do refresh the same page after the data has been entered
pageContext.forwardImmediatelyToCurrentPage(params,true,
OAWebBeanConstants.ADD_BREAD_CRUMB_NO);
Solution:-
1) Create View Object(VO) and write query to display the values in poplist.
VO Name: SuppliersListVO
Query:-
‘YES’ is used to show for user on the OAF page. ‘Y’ is used for internal purpose. The
value ‘Y’ will be stored into database when user selects ‘YES’.
Property Value
Item Style messageChoice
Picklist view Definition train.oracle.apps.ak.suppliers.list.webui.SuppliersLis
tVO
Picklist Display Attribute Meaning
Picklist Value Attribute Code
Page 44 of 67
OAF Training
• How do hide the specified item when user selects the particular value from
Poplist
Solution:-
The concepts “partial page rendering” and “SPEL” should be used to get this solution.
I have one poplist in OAF page and the list has two values “YES” and “NO”. If the
user selects the value “NO”, then the specified item should be invisible on OAF
page at runtime.
Steps:
1) Create properties view object (PVO) and create two attributes.
i) RowKey (Set the properties like below screenshot)
Page 45 of 67
OAF Training
2) Select the option “Tuning” for the same properties VO and select the check box like
below screenshot.
Property Value
Disable Server Side Validation True
Disable Client Side Validation True
Action firePartialAction
Event onholdflagChange
Submit True
5) Configure the item which is invisible according to value of the list item. Here, the
invisible item is “EndDate”. So, set the below property for the item “EndDate”.
Property Value
Rendered ${oa.SuppliersListPVO1.endDateRender}
Page 46 of 67
OAF Training
if ((onhold==null)||("N".equals(onhold)))
{
row.setAttribute("EndDateRender",Boolean.FALSE);
}
else
{
row.setAttribute("EndDateRender",Boolean.TRUE);
}
}
}
onholdflagChange();
}
am.invokeMethod("init");
8) call the onholdflagChange() method from processFormRequest
if
("onholdflagChange".equals(pageContext.getParameter(OAWebBeanConstants.EVENT
_PARAM)))
{
am.invokeMethod("onholdflagChange");
}
In the above code, the “onholdflagChange” is event name. The event of the item will be
worked as form-submit. So, the above code (event related) has been written in
processFormRequest.
Run the OAF page and change the value of the list item. The item “EndDate” will not be
rendered if the value of the list item is “NO”.
Page 47 of 67
OAF Training
Steps:-
1) Set the below properties for item “SupplierId”.
Property Value
Action firePartialAction
Event supplierNameEvent
Submit True
if("supplierNameEvent".equals(pageContext.getParameter(OAWebBeanConstants.
EVENT_PARAM)))
{
int supp_id = Integer.parseInt(pageContext.getParameter("SupplierId"));
if (supp_id==195)
{
am.invokeMethod("supplierNameEvent");
}
Page 48 of 67
OAF Training
• How do create list box and add values to the list box dynamically
Solution:
import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.framework.webui.OAControllerImpl;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.apps.fnd.framework.webui.beans.form.OADefaultListBean;
import oracle.apps.fnd.framework.webui.OAWebBeanConstants;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageLayoutBean;
list.setListViewObjectDefinitionName("train.oracle.apps.ak.suppliers.list.webui.SuppliersL
istVO");
list.setListValueAttribute("Code");
list.setListDisplayAttribute("Meaning");
list.setMultiple(true);
list.setName("SupplierList");
OAMessageLayoutBean listBoxLayout =
(OAMessageLayoutBean)webBean.findChildRecursive("listBoxLayout");
listBoxLayout.addIndexedChild(list);
Page 49 of 67
OAF Training
Step 1: Create a page with a pageLayout region using OA Extension. Make sure the Form
property on the pageLayout region is set to True.
Step 2: Select the pageLayout region in the Structure pane, and choose
New > Region from the context menu.
Set the following properties on this new region (Required properties are marked with *):
*ID - set the shuttle's ID property in accordance with the OA Framework File / Package/
Directory Standards.
Add Indexed Children - make sure this property is set to True, so that OA Framework
automatically generates the web beans under this web bean hierarchy. The default is True.
Available Header - specify the header text of the first (leading) list.
Selected Header - specify the header text of the second (trailing) list.
If you want to implement just one list for Reordering, that is, you do not want to shuttle
items between two lists, then leave this property blank.
Ordering Allowed - set to True if you want to enable ordering of the contents of the
Selected (second or trailing) list.
If you implement only one (leading) list in the shuttle region to create a Reordering region,
then setting this property to True enables ordering on that leading list. The default is False.
Step 3: The Shuttle region can have a maximum of two list web beans, referred to as the
leading and trailing lists. The trailing list is omitted when you want to implement a shuttle
region with a single list for the purpose of reordering the contents of that list.
When you define a shuttle region, OA Extension automatically creates a leading component
for you, which contains a single list item.
Be sure to set the following properties on the list item (Required properties are marked with
*):
*ID - set the list's ID property in accordance with the OA Framework File / Package/
Directory Standards.
Page 50 of 67
OAF Training
*Multi-Select Allowed - set to True to allow the multiple selection of items in the list. The
default is False.
Picklist View Definition - specify the fully qualified view object name that is the data source
to the List web bean.
(For example, oracle.apps.fnd.framework.server.FndApplicationVO)
*Picklist View Instance - alternately specify a view instance name for the data source of the
list, if the Picklist View Definition is not available. Note that setting this property overrides the
Picklist View Definition property.
(For example, FndApplicationVO, which needs to be present in the ApplicationModule.)
*Picklist Display Attribute - specify the view attribute name that serves as the displayed
values of the list's content.
*Picklist Value Attribute - specify the view attribute name that serves as the internal values
of the list's content. This property, and not the Picklist Display Attribute property, uniquely
identifies the elements in the list.
Picklist Description Attribute - specify the view attribute name that serves as the
descriptions of the list's content.
*List Height - specify the suggested display height of the list, in characters. The default is
null. If this property is not set, the height is determined based on the lengths of both lists and
their minimum and maximum values. The value should be in the range of 10 to 20.
Note: The List Height is only a suggested value. Your browser application and UIX
determines the final 446 height of the list based on the number of items in the list and the
size of the browser window.
Step 4: To create an optional trailing list, select the shuttle region in the Structure pane and
choose New >trailing from the context menu. OA Extension automatically creates a trailing
component for you, which contains a single list item.
Refer to Step 3 for the list of properties that you should also set on the trailing list item. Make
sure you specify names for the Picklist Display Attribute, Picklist Value Attribute and Picklist
Description Attribute properties that match the corresponding property of the leading list
item.
Note: If you do not want to pre-populate the trailing list when the page initially renders, you
can leave the Picklist View Definition, Picklist View Instance, Picklist Display Attribute,
Picklist Value Attribute and PicklistDescription Attribute blank. OA Framework takes care
of retaining user selected values in the trailing list when the page refreshes.
Note: The Picklist Value Attribute uniquely identifies the elements in a list, so if you want to
pre-populate both the leading list and trailing list with data, be sure to set the Picklist Value
Attribute property to a different value for each list. Setting this property to the same value for
both lists will result in undesirable behaviour, such as causing the values in the leading list to
disappear.
Step 5: You can include buttons or icons in the footer of each list, as shown in Figure 2.
Select the shuttle region in the Structure pane, and choose New > leadingFooter (for a
Page 51 of 67
OAF Training
footer in the leading list) or New > trailingFooter (for a footer in the trailing list). OA
Extension automatically creates a leadingFooter or trailingFooter component, respectively,
each containing a flowLayout region. You can then add your buttons or icons to this
flowlayout region.
Note: If you set the Rendered property to False for either the leading or trailing list, the
leading or trailing footer also does not render, respectively. Since the footer is directly linked
to its respective list, if the list is not rendered, the footer is irrelevant.
We can design layout like below screen shot by using the stackLayout, rowLayout and
cellFormat region styles.
pageLayoutRegion
|-----stackLayout region
|----rowLayout region
|---------cellFormat region
|-------spacer (item style)
| (width: 400)
|-------item (style: formattedText)
(Text: <b>Authority For Expenditure</b>
(Please look above screenshot for result)
|------stackLayout region
|----rowLayout region
|----cellFormat region
|-----spacer (item style)
| (width: 400)
|-----item (style: formattedText)
(Property Text: <b>Co: 101 XXX Energy Inc</b>)
|--------stackLayout region
|-----rowLayout region
Page 52 of 67
OAF Training
|-----cellFormat region
|------ table region
|----- item1 (style: messageStyledText)
|-----cellFormat region
|------ table region
|----- item2 (style: messageStyledText)
|-----cellFormat region
|------ table region
|----- item3 (style: messageStyledText)
Set the properties for item1, item2 and item3. The properties are
Prompt
View Instance
View Attribute
(Please see table region in above screenshot for result)
Solution:-
pageLayoutRegion
|-----stackLayout region
|----rowLayout region
|---------cellFormat region
|-------item (messageTextInput)
|---------cellFormat region
|-------item (style: spacer; width: 50)
Page 53 of 67
OAF Training
Plain Text -- produces a plain text version of the page (typically used to send a plain
text version of a page to an e-mail client). Note that the plain text LAF does not
support all the existing component styles.
Example:
OA.jsp?
page=/train/oracle/apps/ak/employee/webui/EmpDetailsPG&employeeNumber={@Empl
oyeeId}&retainAM=Y&addBreadCrumb=Y&OALAF=minimal
Call the page “EmpDetailsPG” from any another page and observe appearance of the
“EmpDetailsPG”. Please find the below screen shot. (OALAF=minimal)
Page 54 of 67
OAF Training
From above screenshot, some text is showing in green color. Try for “blaf” and “oaText”
LAFs like above.
• Width of a table
• Table formatting
• Single selection and multiple selection on a table and adding other controls to a
selection bar
• Totalling a column
Page 55 of 67
OAF Training
• Detail Disclosure
• Row Headers
• Wrap Settings
Page 56 of 67
OAF Training
}
Go to the corresponding Application Module and write below code to create row and
execute query.
(i.e. pagelayout region AM Definition property value)
import oracle.jbo.Row;
Page 57 of 67
OAF Training
In AdvancedTable, this is good feature to add row dynamically and display total on footer
without write code.
Declarative implementation
Select the “advancedTable” region and press right mouse button and select the option
“footer”.
After select the “footer” option, the footer and tableFooter1 components will be
created. See below screenshot.
Select the “tableFooter1” and press right mouse button and select the option
“addTableRow”. See below screenshot.
Page 58 of 67
OAF Training
Run the page once and you will get “Add another Row” button at the footer of
advancedTable.
Select “total” option to display total of particular column (salary). The option “total”
showing in above screen shot.
We need to set one property “Total Value” as True for salary column (column4 in
below screen shot) and run the page.
See the below screenshot to know the final output of advancedTable. (Add Another
Row button, Recalculate button and total value for salary column)
Page 59 of 67
OAF Training
After press the “Add Another Row” button, one blank record will be created. See below
screen shot.
Note: The total displays a double precision summation of all visible rows in the table.
The total reflects only the current visible records and not all the records queried.
Page 60 of 67
OAF Training
Code:
public void setItemDetailsSno()
{
OAViewObject vo = (OAViewObject)getCMCostchangeVO();
CMCostchangeVORowImpl row = null;
int fetchedRowCount = vo.getRowCount();
// we use a separate iterator -- even though we could step through the
// rows without it -- because we don't want to affect row currency.
insertIter.closeRowSetIterator();
}
See below screenshot and check the values of serial number
Page 61 of 67
OAF Training
Code:
oracle.apps.fnd.framework.OAApplicationModule
am=pageContext.getApplicationModule(webBean);
OAAdvancedTableBean tableBean =
(OAAdvancedTableBean)webBean.findChildRecursive("AdvancedtblRN");
if (tableBean.getName().equals(pageContext.getParameter(SOURCE_PARAM))
&& ADD_ROWS_EVENT.equals(pageContext.getParameter(EVENT_PARAM)))
{
am.invokeMethod("setSequenceNum");
}
Note: From above code, ADD_ROWS_EVENT is event name for “Add Another Row”
button.
Write below code in Application Module which is added to your pagelayout region.
Imp: Set the property “insert rows automatically” as False in addTableRow1 object
at footer of advanced table.
Result: Display Serial Number (transient attribute) according to current row position
dynamically after pressing the “Add Another Row” button.
See below screen shot, after press the “Add Another Row” button
New row is created and added onto table, and SerialNumber is also incremented (from
6 to 7) and displayed on table. See below screenshot.
Page 62 of 67
OAF Training
Solution:-
decode(NVL(SequenceNumberEO.ON_HOLD_FLAG,'Y'),'Y',
'DeleteEnabled',
'DeleteEnabled') AS DELETE_SWITCHER
Page 63 of 67
OAF Training
From above screenshot, the value of Name is “supplierNUM”. It is used to get serial
number when user clicks the delete switcher at runtime.
After setting above properties, Write below code in Application Module for removing
the selected record.
Page 64 of 67
OAF Training
Press the Delete switcher of any record and then check the output. Now, the record still
available in database because of not committed this transaction. After press the “Save”
button, the record will be removed from the database.
If user wanted to show checkbox for onHoldFlag column, then we need to change the item
style of the “onHoldFlag” item as “messageCheckBox”. Set the below check box properties
checkedValue: Y ; uncheckedValue: N
Page 65 of 67
OAF Training
After press the clear button, the data will be cleared. See below screenshot.
Page 66 of 67
OAF Training
• BIBLIOGRAPHY :-
http://oracle.anilpassi.com/oa-framework-training-tutorial-03.html
[Practical example has been given about how to create row and save the row by using
VO]
http://oracle.anilpassi.com/restart-or-bounce-apache-in-oracle-apps-11i-2.html
[Restart or Bounce Apache in Oracle Applications 11i]
http://oracle.anilpassi.com/master-detail-screen-in-oa-framework-part-i-2.html
[Develop Master Detail screens in OA Framework]
Page 67 of 67