Académique Documents
Professionnel Documents
Culture Documents
com/
Raju Ch
What is OA Framework ?
Before starting about OA Framework, lets try to understand the word Framework:
As more and more applications are being developed, new technologies are also evolving
at the same time.
If we look at our web application from scratch, even state is not maintained for our pages.
For example, I want to create a search form. When I click on search/submit button, the
criteria fields will not retain their values automatically. Also we use javascript for
validations and lots of other things for similar basic functionalities.Now, the solution to
these problems is that lots of frameworks are there in which such common functionalities
are already done (pre-written) for us.
So whether it is Sun or Oracle or Microsoft, the main motive behind creating frameworks
is that the attention of developers should only be towards developing the application i.e.
the business rule (such as what tax should be deducted from an invoice) and get rid of all
other things like request.getParameter or making input fields inside an HTML file.
Because these things are not contributing to that part of software development which is
directly related to users. By doing this we are not implementing any business rule. The
aim here is to do these tasks ASAP so that developers can only concentrate on
implementing the business application.
.C
One more thing I want to put here is: difference between API & Framework:
API is a library. At times we instantiate objects of library code and call their
functions.
Framework on the other side is like that there is already some blocks of code
written and we have have to fit our own code somewhere inside those blocks.
So to fit our code what we do is that sometimes we make our classes to inherit
from other classes, implement the methods what framework specifies. This is what
happens in most of the frameworks.
For example we want to make our application on MVC architecture. So for that
we can use Structs (a framework which provides built in support for MVC). However
this doesnt provide much support for UI.
.B
8
S
P
A
E
OAF Framework developed by Oracle for building and launching web pages within
Oracle E-Business Suite (EBS).
Below is a sample web page of Oracle EBS:
http://oracleapps88.blogspot.com/
Raju Ch
All pages within EBS are almost similar in look and feel. Based on this fact, below is
some common functionality which is already provided by this framework so that we can
mainly concentrate on implementing business logic:
Inbuilt support for Apps specific features like flex fields, menus etc..
Provide classes for all standard components seen on pages like text fields, buttons,
tables etc..
Almost every implementation of EBS has to make some changes to some of these
pages. OAF has mechanism to implement these changes in such a way that the
changes are not wiped out even after patches delivered by Oracle are applied.
Since OAF is used only for creating EBS pages, copyright links and global links
are provided by this framework by default.
.C
And what OAF does is the programmatic binding among all these.
.B
8
UIX framework is J2EE-based framework for building web applications and is based on
MVC design pattern.
The main focus of UIX is the user presentation layer of an application. UIX is platform
independent as it is implemented in the Java programming language. UIX development
can be declarative, using uiXML, an XML language for creating UIX pages.
S
P
A
UI Components:
E These are implemented as Java Beans. They include page layouts and
simpleL
UI objects that map to standard HTML controls, such as buttons, forms, and
checkboxes. There are other complex components, such as trees, hide-show controls,
Cetc.
LOV
A
UIX includes a set of UI components and classes for rendering them:
Renderers: These are Java classes for rendering the UI components to target
clients/devices. For example, components are rendered as HTML for use in web browsers
or as WML for use in mobile devices.
Classes for UIX Components are in the oracle.cabo.ui package.
uiXML: This is an XML language for programming UIX applications. uiXML provides
a declarative way of creating web applications programmatically using UIX Java APIs.
The pages, events, and any other items defined with uiXML elements are all transformed
into Java objects behind the scenes. Below is an example of a uiXML element (button):
http://oracleapps88.blogspot.com/
Raju Ch
.C
A UIX page consists of a hierarchical set of components known as UI nodes. Some nodes
define visible components, such as buttons, images, text fields, while others organize the
layout and appearance of other nodes.
Nodes can have parents and children, and multiple nodes together form a tree-like
structure used to represent a pages logical structure.For example, left part below figure
shows a logical hierarchy of UI nodes and right part shows the same hierarchy rendered
as an HTML page.
.B
8
S
P
A
Ethere is a java class for each UI nodes. These classes implement the UINode
Now in UIX,
L
interface in the oracle.cabo.ui package. The UINode interface contains methods for the
characteristics
of nodes, such as:
C
Apublic int getIndexedChildCount(RenderingContext context);
http://oracleapps88.blogspot.com/
Raju Ch
C - Controller
Developers manipulate the applications metadata using Oracle 9i JDeveloper OA
Extension, while OA Framework uses the most efficient manner to execute the
application.
The MVC architecture is a component-based design pattern with clean interfaces between
the Model, View and Controller.
.C
Find the following MVC diagram to understand relationship between Model, View and
Controller.
1.1
About Model
The OA Framework Model is implemented using Oracle Business Components for Java
(BC4J).
O
L
BC4J provides optimized, ready-to-use implementations
of the J2EE design patterns.
.B
Development teams can focus immediately and
only, on writing business logic and user
interfaces instead of designing, coding,
and debugging handcrafted application
8
plumbing code.
8
1.2
About View
S
The OA Framework View is implemented using UI XML (UIX).
P
UIX uses XML to describe the components and hierarchy that make up an application
P
page.
UIX provides runtime
capabilities to translate that metadata into HTML output so that it
A
can be shown
Eon a Browser.
L
The metadata used to describe the UI is loaded into a database repository, called Meta
CServices (MDS), at deployment time and optionally at design time as well.
Data
A
1.3
About Controller
User and Application-driven interactions are handled by the OA Controller, which is
pure Java Class implementation.
Within the Model-View-Controller architecture, the OA Framework draws a clear
distinction between client and server classes.
Client classes (View and Controller) drive the HTML user interface.
Server classes (Model code) can support any client (not just OA Framework user
interfaces)
http://oracleapps88.blogspot.com/
Raju Ch
2. Key Features
Integrated Development Environment
Durable Personalizations and Extensions
Consistent and Compelling User Interface
Object Oriented Reuse
2.1 Integrated Development Environment (IDE)
Oracle 9i JDeveloper with OA Extension is a world-class J2EE-based integrated
development environment. Oracle customers and third party consultants have access to
the same tools used by Oracle E-Business Suite developers to build complementary
applications as well as extend the Oracle E-Business Suite applications.
.C
.B
Extensibility is about extending the functionality
of an application beyond what can be
8
done through personalization.
8
S
Examples:
P
Adding new functional flows
P existing functional flows
Extending or overriding
Extending
or overriding existing business logic
A
E and Compelling User Interface
2.3 Consistent
L
OA Framework offers developers a wide range of user interface components that make
Cbuilding of applications into a more assembly process, freeing developers from the
the
Arepetitive composition of common user interface constructs.
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.
2.4 Object Oriented Reuse
OA Framework applications can be abstracted into a series of concentric layers, like an
onion.
(Note: Describe the objects mentioned in diagram in the following pages)
http://oracleapps88.blogspot.com/
Raju Ch
3. OA Framework Essentials
Key JSP Application Components
C
.
1)The Browser communicates with the middle tier using HTTP which involves sending a
T
request message to which the middle tier replies with a response message.
O
2)A JSP is a file with some HTML and JAVA code that executes top to bottom.
P At
runtime, it is compiled into a Java class which is actually a Servlet. S
G that implements a
3)A Servlet is a Java web based application server extension program
O
Standard API.
L
4)A Servlet Session is a mechanism for maintaining
state between HTTP requests during
.Band
a period of continuous interaction between Browser
Web Application. A Session
may be initiated at any time by the application
and
terminated
by the application, by the
8
user closing the browser, or by a period
of inactivity.
8
A session usually corresponds to
an
application
login/logout cycle.
S
P
5)A JavaBean (Bean for short) is simply a reusable component that implements
Pto make it easy for programmers and development tools to
specific design patterns
discover the objects
Aproperties and behavior.
E
6)AnyL
objects in the middle tier that communicate with the database use a JDBC (Java
DataBase Connectivity).
C
ADiagram to understand the above points
This chapter describes how to implement your model objects in generic terms.
Business Components Packages
All BC4J (Business components for Java) model components must belong to a Business
Components Package.
http://oracleapps88.blogspot.com/
Raju Ch
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.
.C
Entity objects use a declarative mapping between their attributes and underlying database
columns to automatically implement queries, inserts, updates and deletes.
ii) EmployeeEOImpl.java
.B
8
S
P
A
E
2) View Objects
http://oracleapps88.blogspot.com/
Raju Ch
.C
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)
.B
8
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.
S
P
A
Example: A
order header references a supplier, but the supplier can still exist
Epurchase
regardless
of
whether
a
purchase order references it or not.
L
4)C
A Application Modules
Reference: - The source entity object simply references the destination object.
o
o
o
http://oracleapps88.blogspot.com/
Raju Ch
At development time, you specify the bean hierarchy for every page using the JDeveloper
tool.
OAF page comprised of regions and items.
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
.C
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.
.B
Controllers for regions
8
processRequest method (code for 8
page initialization such as HTTP GET actions and so
on)
S
processFormRequest method (code for HTTP POST actions. When press the button the
P
code will be executed)
P
Typical Locations
for Code
A
We could not
Ecall methods of Entity Objects (EO) from Controller directly. We have to
followL
below order to call method from location to other location.
1)CCall methods of ApplicationModule from Controller only
A2) Call methods of ViewObject from ApplicationModule only
3)
4)
http://oracleapps88.blogspot.com/
Raju Ch
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.
.C
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).
.B
6) NEVER create Form Beans in code (this
means NEVER add nested Form beans to a
8
page; your Page Layout region should
only form region). Multiple form Beans on
8bein thestrange
a page are not supported and can
result
runtime behaviors.
S
P
7) NEVER count on your Application Module using the same database connection in
Pexample, NEVER post and commit in separate requests. For
subsequent requests. For
performance reasons,
the Framework will start pooling and reusing connections in 5.7
A
instead of holding
E onto a single connection throughout the life of an Application Module.
L
8) NEVER use JDBC directly unless you're calling a PL/SQL routine (you should use a
Cobject instead, and if possible, the view object should be defined declaratively and
view
Anot programmatically).
8.
Create Simple OAF WELCOME Page
Step 1: Open JDeveloper tool, Create New OAworkspace.
http://oracleapps88.blogspot.com/
Raju Ch
.C
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.
.B
Application Short Name: AK
8
Responsibility Key
: FWK_TBX_TUTORIAL
8
S
Press Finish button.
P
P OAProject and front-end connections successfully
Now, creation of OAWorkspace,
completed.
A
E
L
Step 4: Create new OA page
C Select project name (xxxOAProject) and click right mouse button, then select
ANew
option.
New window will be opened, and then select WebTier under categories list.
Select OA Components option under Web Tier and select Page right side.
Press OK Button.
Step 5: Enter page name as XXXWelcomePG in Name field.
http://oracleapps88.blogspot.com/
Raju Ch
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.
Property Name
ID
Region Style
Window Title
Title
AM Definition
Value
MainRN
PageLayout
Welcome Window
Welcome Page
oracle.apps.fnd.framework.server.OAApplicationModule
Note: we are not yet creating Application Module. So, this
application module is using which is default.
.B
8
Select MainRN and click right mouse button, select region Option and set the
8
below properties.
S
Property Name
Value
P
ID
SubRN
Region Style P
Messagecomponentlayout
A
Step 7: Create item under SubRN
E
L
C Select the region SubRN and click right mouse button, and then select the
option
A messageTextInput and set the below properties.
Step 6: Create subregion (style: messagecomponentlayout) under the Pagelayout region.
Property Name
ID
Region Style
Prompt
Additional Text
Value
WelcomeTxt
messageTextInput
Enter Your Name
Enter any string to display it
on the page
.C
Set the properties for root region (region1) in property inspector window.
http://oracleapps88.blogspot.com/
Raju Ch
.C
See the below OAF page screenshot and verify the window title, page title and text item
prompt with above properties.
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.
8.
Practical Problems and Solutions
.B
8
8
Step 1: Create button itemS
under the sub region SubRN.
Select the region SubRN and click right mouse button, select the option
P
messagelayout (is used to place the buttons).
P
A
Property Name
Value
ID E
ButtonLayout
L
CStep 2: Create button item under the ButtonLayout.
Select the region ButtonLayout and click right mouse button, and select
the
Option item.
Value
Go
submitButton
http://oracleapps88.blogspot.com/
Prompt
Additional Text
Raju Ch
Go
Click the button
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).
When press the Go button, the button related code will be executed from
processFormRequest method (like Java POST method).
O
L
Logic to display the message Welcome <value of text item> on OAF page. Add below
code in the method processFormRequest. B
.
8
Code:
if (pageContext.getParameter("Go")!=null)
8
{
S
String str=pageContext.getParameter("WelcomeTxt");
P
String message="Welcome "+str;
P
throw new OAException(message,OAException.INFORMATION);
A
}
E
In above
code, Go is button name (not prompt) which is used in if condition.
L
WelcomeTxt is also text item id (not prompt).
C
AWhen user press the Go button, the browser will send the request to middle tier and
The processRequest code will be executed at the time of initializing the page.
The OAException class is used to display the message on the OAF page. The second
parameter is exception type INFORMATION.
There are some more exception types available. They are:
1) CONFIRMATION
2) WARNING
3) ERROR
.C
http://oracleapps88.blogspot.com/
4)
Raju Ch
SEVERE
Note: The exception types ERROR and SEVERE terminate the program.
The exception types INFORMATION, CONFIRMATION and WARNING
are
continue the execution of 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).
Message: WELCOME OAF students
(Exception type: INFORMATION)
Product Branding:
Select pageLayout components and click right mouse button, and select the
productBranding option.
.B
Set the below properties for productBranding
8 item
Property Name
8 Value
ID
Item1 (as you like)
S
Item Style
Image
P
ImageURI
/OA_MEDIA/FNDTAPPBRAND.gif
P
Additional Text
Click the button
A
E
Set the system
L profile FND: Branding Size as Medium at site level.
IfC
you change menus or profile values etc, then we have to terminate the OAF page.
Navigation: RUN->Terminate->Embedded OC4J Server (Menu bar)
ACompile and run the OAF page (.xml), check the output from below screenshot.
.C
http://oracleapps88.blogspot.com/
Raju Ch
Select pageLayout Components region and click right mouse button, then select the
InContextBranding option.
.C
Value
Item2 (as you like)
formattedText
Customer SUN MicroSystems-Menlo Park
We can use html tags to change font styles or display font in bold etc.
.B
8
Output:
S
P
Code:
OAMessageTextInputBean fieldHelloTxt=
(OAMessageTextInputBean)webBean.findChildRecursive(WelcomeTxt);
A
E is a Text Item ID. Write above code in processRequest method
Where WelcomeTxt
of CONTROLLER.
L
C
Important Note:
AWe have to import the class OAMessageTextInputBean.
fieldHelloTxt.setText(pageContext, welcome to OAF students);
import oracle.apps.fnd.framework.webui.beans.message.
OAMessageTextInputBean;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
How do hide Text item at runtime
Code:
The Method setRendered is used to hide the text item. Pass the value false for this
method.
http://oracleapps88.blogspot.com/
Raju Ch
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);
Code:
We have to use OASubmitButtonBean to change behavior of buttons at runtime.
import oracle.apps.fnd.framework.webui.beans.form.OASubmitButtonBean;
.B
8
OASubmitButtonBean goButton =
(OASubmitButtonBean)webBean.findChildRecursive("Go");
goButton.setDisabled(true);
S
P
A
E
Dynamically,
L display the rawText by using OARawTextBean
C
OARawTextBean
rawtxt = (OARawTextBean)webBean.findChildRecursive("item3");
A
.C
http://oracleapps88.blogspot.com/
Raju Ch
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"))
{
pageContext.setForwardURL("OA.jsp?page=/train/oracle/apps/ak/welcome/webui/Welco
mePG",
null,
OAWebBeanConstants.KEEP_MENU_CONTEXT,
null,
null,
true,
OWebBeanConstants.ADD_BREAD_CRUMB_YES,
OAWebBeanConstants.IGNORE_MESSAGES);
}
.C
.B
8
Enter user name and password correct,
and then press Go button.
8
Note: Set text item property secret
as True when enter password. User could not see
S
the password while entering.
P
The below page WelcomePG will be opened.
P
How do display
A the Return Navigation link on the page
E
Suppose,
if user call second page from first page and perform some actions on the second
L
page. Later, the user wants to go back to first page, then we have to use Return
C link.
Navigation
A
Select the region pageLayoutRN and click right mouse button, and then select the
option returnNavigation.
Set the properties for returnNavigation item.
Value
Property
Name
ID
returnLink
http://oracleapps88.blogspot.com/
Item
Raju Ch
link
Style
Destinatio
n URI
Text
OA.jsp?page=/train/oracle/apps/ak/security/webui/SecurityPG&retainAM=
Y
Return to Security Page
.C
.B
8
S
P
A
((OAPageLayoutBean)webBean).setReturnNavigation(returnLink);
E
L
}
C
A
// Add the return link to the page.
http://oracleapps88.blogspot.com/
Raju Ch
oracle.apps.fnd.framework.OAApplicationModule am =
pageContext.getApplicationModule(webBean);
String task2Info = null;
PreparedStatement psProType = null;
ResultSet rsProType = null;
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);}
.B
8
Code:
Place the button Callable and write above code in processFormRequest method
S
P
import java.sql.Connection;
P
import oracle.jdbc.OracleCallableStatement;
A
if (pageContext.getParameter("Callable")!=null)
E
{ L
try
C
A {String deleteStmt = "BEGIN DELETE_RECORD( " +
.C
http://oracleapps88.blogspot.com/
Raju Ch
.C
.B
8
S
P
A
How E
do call D2K Form from OAF page
Syntax:
L
form:responsibilityApplicationShortName:responsibilityKey:securityGroupKey:fun
C
ctionName
A
FWK_TBX_T_EMP_DELETE_CONFIRM is message name in AOL.
Code:
pageContext.forwardImmediatelyToForm("form:PO:PURCHASING_OPERATIONS:ST
ANDARD:PO_POXPOEPO");
Result:
Write above code in controller for button. Opens the PO Form when click the button.
http://oracleapps88.blogspot.com/
Raju Ch
.C
Right click > New View Object (This will open a wizard having 7 steps).
Step 1
Package: xxcus.oracle.apps.fnd.emprec.server
Name: XxEmployeeSearchVO
Choose the radio button Read-only Access (as we are not performing any DML
operation). Click Next.
Step 2
Enter the below query in Query Statement:
SELECT empno, ename, job, mgr, hiredate, sal, deptno FROM employee
Keep defaults for step3, 4, 5, 6
Step 7
Select check boxes for Generate Java File for both View Object Class and View Row
Class. Click Finish.
4) Create a new Application Module (AM):
.B
8
S
P
A
E
Step 1
Package: xxcus.oracle.apps.fnd.emprec.server
Name: XxEmployeeAM. Click Next.
Step 2
Here we will add an instance of the VO created in (3). Select XxEmployeeSearchVO
from Available View Objects and shuttle it to Data Model using > button.
Keep defaults for all other steps (3, 4). Click Finish.
5) Create a new Controller class :
Step 1
Select XxEmployeeSearchPG in navigator tab. Declarative form of page will be visible in
structure tab.
Step 2
Right click on pageLayout region > set new controller (This will open a popup
window). Enter the below details:
http://oracleapps88.blogspot.com/
Raju Ch
.C
.B
8
Now change the properties for each field from property inspector as shown below:
pageLayout:
ID: pageLayoutRN
AM Definition: xxcus.oracle.apps.fnd.emprec.server.XxEmployeeAM
Window Title: Employee Search Page
Title: Employee Search
S
P
A
E
http://oracleapps88.blogspot.com/
Raju Ch
4) Again create a region under pageLayout. However this time, choose Region Using
Wizard.
Step 1
select XxEmployeeAM from Application Module drop down and select
XxEmployeeSearchVO1 in available view usages. Click Next.
Step 2
choose region style as table from drop down. Click Next.
Step 3
shuttle all the fields from available to selected attributes. Click Next.
Step 4
Change the style to messageStyledText for each row. Also modify the prompt to make it
more user friendly (like empName to Employee Name).
The declarative page structure in jDev will be similar to as shown below:
.B
8
S
P
A
E
User will enter search criteria (emp num or name) and click on Go button.
.C
http://oracleapps88.blogspot.com/
Raju Ch
Get the criteria fields and pass those to AM where we define a method to perform
search.
Write the below code in PFR method of controller:
view plaincopy to clipboardprint?
1. public void processFormRequest(OAPageContext pageContext,
2.
OAWebBean webBean) {
3. super.processFormRequest(pageContext, webBean);
4.
5. OAApplicationModule am = pageContext.getRootApplicationModule();
6.
7. if (pageContext.getParameter("goBtn") != null) {
8.
9.
if ((!("".equals(pageContext.getParameter("empNum").trim()))) ||
10.
(!("".equals(pageContext.getParameter("EmpName").trim())))) {
11.
String empNum = pageContext.getParameter("empNum");
12.
String empName = pageContext.getParameter("EmpName");
13.
if (("".equals(pageContext.getParameter("empNum").trim()))) {
14.
empNum = null;
15.
}
16.
17.
Serializable[] param = { empNum, empName };
18.
am.invokeMethod("searchEmployee", param);
19.
} else {
20.
throw new OAException("Please Enter Search Criteria.",
21.
OAException.ERROR);
22.
}
23. }
24. }
Below is code for searchEmployee method in XxEmployeeAMImpl.java :
view plaincopy to clipboardprint?
1. public void searchEmployee(String empNum, String empName) {
2. try {
3. XxEmployeeSearchVOImpl vo = getXxEmployeeSearchVO1();
4. vo.setMaxFetchSize(-1);
5. vo.setWhereClause(null);
6. vo.setWhereClauseParams(null);
7. vo.setWhereClause("EMPNO = nvl(" + empNum + ",EMPNO)" +
8.
"AND UPPER(ENAME) like UPPER('%" + empName + "%')");
9. System.out.println("search query - " + vo.getQuery());
10. vo.executeQuery();
11.
12. } catch(Exception e) {
13. e.printStackTrace();
14. }
15. }
.C
.B
8
S
P
A
E
http://oracleapps88.blogspot.com/
Raju Ch
4. Create Test Table and insert data some data in it (For Testing Purpose)
CREATE TABLE xx_search_demo
( -- --------------------- Data Columns
-- -------------------column1
VARCHAR2(100),
column2
VARCHAR2(100),
-- --------------------- 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
);
INSERT INTO xx_search_demo VALUES (val1, val2, SYSDATE, 0, SYSDATE, 0,
0);
INSERT INTO xx_search_demo VALUES (val1, val2, SYSDATE, 0, SYSDATE, 0,
0);
INSERT INTO xx_search_demo VALUES (val3, val4, SYSDATE, 0, SYSDATE, 0,
0);
INSERT INTO xx_search_demo VALUES (val5, val6, SYSDATE, 0, SYSDATE, 0,
0);
Now we have 4 records in our custom table
.B
8
S
P
A
E
.C
http://oracleapps88.blogspot.com/
Raju Ch
Right click on SearchDemo > New > ADF Business Components > Entity Object
Name SearchEO
Package -- prajkumar.oracle.apps.fnd.searchdemo.schema.server
Database Objects -- XX_SEARCH_DEMO
Note By default ROWID will be the primary key if we will not make any column to be
primary key Check the Accessors, Create Method, Validation Method and Remove
Method
6. Create a New View Object (VO)
Right click on SearchDemo > New > ADF Business Components > View Object
Name -- SearchVO
Package -- prajkumar.oracle.apps.fnd.searchdemo.server
In Step2 in Entity Page select SearchEO and shuttle them to selected list
In Step3 in Attributes Window select columns Column1, Column2 and shuttle them to
selected list
In Java page Select Generate Java file for View Object Class: SearchVOImpl
and Generate Java File for View Row Class: SearchVORowImpl
.C
.B
8
S
P
9. Select the SearchPG and go to the strcuture pane where a default region has been
created
A
E
http://oracleapps88.blogspot.com/
Raju Ch
.C
.B
8
S
P
14. Set or Verify Column1 Item Properties
P
Search Allowed -- True
Sort Allowed A
ascending
Initial Sort E
Seqence first
Selective
Search
Criteria True
L
User Personalization True
C
A15. Set or Verify Column2 Item Properties
16. Congratulation you have successfully finished Search page. Run Your SearchPG
page and Test Your Work
http://oracleapps88.blogspot.com/
Raju Ch
.C
.B
8
S
P
A
E
http://oracleapps88.blogspot.com/
Raju Ch
Select Attribute
EmployeeId1
FullName
FullName1
EmailAddress
EmailAddress1
.B
8 Name and Alias Name
Attribute
ManagerId and MANAGER_ID
8
and EMPLOYEE_NAME
S EmployeeName
and MANAGER_NAME
P ManagerName
EmployeeEmail and EMPLOYEE_EMAIL
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
.C
http://oracleapps88.blogspot.com/
Raju Ch
.B
8
S
P Search.
Configure RESULT-BASED
18) Create region with
style
P query under pageLayout Region.
A
Set the below properties for the region queryRN.
Property E
Value
L
ID
queryRN
C
Item Style
Query
Result Based Search
AConstruction Mode
.C
True
True
True
http://oracleapps88.blogspot.com/
Raju Ch
.C
.B
8
S
P
A
E
ACode:
import oracle.jbo.domain.Number;
import oracle.apps.fnd.framework.OAException;
public void initQuery(String employeeNumber)
{
If (employeeNumber! =null)
{
Number empNum=null;
Try
{
http://oracleapps88.blogspot.com/
Raju Ch
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();
}
}
.C
EmployeeFullVOImpl empvo=getEmployeeFullVO1();
Empvo.initQuery(employeeNumber);
}
11) Create the CONTROLLER and call the procedure initDetails.
12) Write code in processRequest method
.B
Code:
8
String empnum=pageContext.getParameter(employeeNumber);
8
OAApplicationModule am=pageContext.getApplicationModule(webBean);
S
Serializable[] parameters={empnum};
P
Am.invokeMethod(initDetails, parameters);
P
Result: we canA
get the details of employee according to employee ID.
E
How
L do display custom copy right on OAF page
C
Solution:
A
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.
How do get the value of the checkbox when selected or deselected
http://oracleapps88.blogspot.com/
Raju Ch
Solution:
Bydefault, the checkbox returns on when selected.
The checkbox returns null when deselected.
According to on and null values, we can do validation on the checkbox.
Code:
.C
{
System.out.println(Male);
}
If (val==null)
{
System.out.println(Female);
}
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)
.B
8
How do insert data from OAF8
Page to Database table by using View Object
S
Steps
P
1) Create view object with query.
Pmodule and attach the view object
2) Create application
3) Create OAF
page and attach application module.
A
4) Create E
Controller and write below code.
L
C
Aimport oracle.apps.fnd.framework.OAApplicationModule;
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.*;
http://oracleapps88.blogspot.com/
Raju Ch
Method: processRequest ()
**********************************
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processRequest(pageContext, webBean);
OAApplicationModule am=pageContext.getApplicationModule(webBean);
am.invokeMethod("initQuery",null);
}
Method: processFormRequest ()
****************************************
.C
if (pageContext.getParameter("Apply")!=null)
{
try
{
OAApplicationModule am=pageContext.getApplicationModule(webBean);
// Date update_date=pageContext.getCurrentUserDate();
// System.out.println("current date="+update_date);
.B
OAMessageTextInputBean supplier_id
=
8
(OAMessageTextInputBean)webBean.findChildRecursive("SupplierId");
8
String sup_id_txt=supplier_id.getText(pageContext);
S
int sup_id=Integer.parseInt(sup_id_txt);
P
P sup_name =
OAMessageLovInputBean
(OAMessageLovInputBean)webBean.findChildRecursive("SupplierName");
A
String supname_txt=sup_name.getText(pageContext);
E
L
onhold_flag =
COAMessageTextInputBean
(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;
PreparedStatement psProType = null;
ResultSet rsProType = null;
http://oracleapps88.blogspot.com/
Raju Ch
int task2Type = 0;
Connection conn = am.getOADBTransaction().getJdbcConnection();
task2Info = "INSERT INTO
FWK_TBX_SUPPLIERS(SUPPLIER_ID,NAME,ON_HOLD_FLAG,START_DATE,E
ND_DATE,LAST_UPDATE_DATE,LAST_UPDATED_BY,CREATION_DATE,CRE
ATED_BY) VALUES(:1,:2,:3,:4,:5,SYSDATE,0,SYSDATE,0)";
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);
}
}
.C
.B
8
Write below methods in Application
8Module which is corresponding to view object.
S
// it is used to create row in view object cache, and then user can enter and insert
P
data into table.
P
public void initQuery()
A
{
E vo=getSuppliersVO1();
SuppliersVOImpl
L
Row row=vo.createRow();
C
A}vo.insertRow(row);
// 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.
http://oracleapps88.blogspot.com/
Raju Ch
.C
pageContext.forwardImmediatelyToCurrentPage(params,true,
OAWebBeanConstants.ADD_BREAD_CRUMB_NO);
How do set the values in poplist
Solution:1)
Create View Object(VO) and write query to display the values in poplist.
VO Name: SuppliersListVO
Query:-
.B
8
YES is used to show for user on the
OAF page. Y is used for internal purpose. The
8
value Y will be stored into database
S when user selects YES.
P
Set the properties for an item:P
Property A
Value
Item Style
messageChoice
E
Picklist
view Definition
train.oracle.apps.ak.suppliers.list.webui.SuppliersListVO
L
Picklist Display Attribute Meaning
C
A Picklist Value Attribute Code
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.
http://oracleapps88.blogspot.com/
Raju Ch
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.
Note: This example followed above screen shot page.
Steps:
1) Create properties view object (PVO) and create two attributes.
i) RowKey (Set the properties like below screenshot)
.C
2) Select the option Tuning for the same properties VO and select the check box like
below screenshot.
3)
Attach the propertiesVO (SuppliersListPVO) to application module
(SuppliersAM).
4)
Configure the list item (onholdflag item). Set the below properties.
Property
Disable Server Side Validation
Disable Client Side Validation
Action
Event
Submit
Value
.B
True
8 True
S
P
A
E
firePartialAction
onholdflagChange
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.
A6)
Property
Rendered
Value
${oa.SuppliersListPVO1.endDateRender}
http://oracleapps88.blogspot.com/
Raju Ch
row.setAttribute("EndDateRender",Boolean.FALSE);
}
else
{
row.setAttribute("EndDateRender",Boolean.TRUE);
}
}
public void init()
{
OAViewObject
appPropsVO=(OAViewObject)findViewObject("SuppliersListPVO1");
if (appPropsVO!=null)
{
if (appPropsVO.getFetchedRowCount()==0)
{
appPropsVO.setMaxFetchSize(0);
appPropsVO.executeQuery();
appPropsVO.insertRow(appPropsVO.createRow());
OARow row=(OARow)appPropsVO.first();
row.setAttribute("RowKey",new Number(1));
.C
.B
8
}
}
onholdflagChange();
S
P
A
am.invokeMethod("init");
E
8)
call the onholdflagChange() method from processFormRequest
L
C
if
A("onholdflagChange".equals(pageContext.getParameter(OAWebBeanConstants.EVENT_
7)
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.
http://oracleapps88.blogspot.com/
Raju Ch
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.
How do fire event? To display supplier name according to supplier id.
There are two text items on OAF page. They are
I) SupplierId II) SupplierName
Steps:1)
Set the below properties for item SupplierId.
Property
Value
Action
firePartialAction
Event
supplierNameEvent
Submit
True
2)
.C
if("supplierNameEvent".equals(pageContext.getParameter(OAWebBeanConstants.
EVENT_PARAM)))
{
int supp_id = Integer.parseInt(pageContext.getParameter("SupplierId"));
if (supp_id==195)
{
am.invokeMethod("supplierNameEvent");
}
}
.B
8
S
P
public void supplierNameEvent()
P
{
A suppvo =
OAViewObject
E
(OAViewObject)findViewObject("SuppliersVO1");
L supprow=(OARow)suppvo.getCurrentRow();
OARow
supprow.setAttribute("SupplierName","Ramprasad");
C
}
3)
http://oracleapps88.blogspot.com/
Raju Ch
.C
O
L
list.setListViewObjectDefinitionName("train.oracle.apps.ak.suppliers.list.webui.Supplier
.B
sListVO");
list.setListValueAttribute("Code"); 8
list.setListDisplayAttribute("Meaning");
8
list.setMultiple(true);
S
list.setName("SupplierList");
P
OAMessageLayoutBean listBoxLayout =
P
(OAMessageLayoutBean)webBean.findChildRecursive("listBoxLayout");
A
listBoxLayout.addIndexedChild(list);
E
L
}
CCreate a Shuttle Region
AFollowing is a brief outline of the steps to create a Shuttle region.
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 *):
http://oracleapps88.blogspot.com/
Raju Ch
*ID - set the shuttle's ID property in accordance with the OA Framework File / Package/
Directory Standards.
*Region Style - set the region style to shuttle.
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.
.C
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 *):
.B
8
S
P
*ID - set the list's ID property in accordance with the OA Framework File / Package/
Directory Standards.
A
E
*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.
http://oracleapps88.blogspot.com/
Raju Ch
*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.
Rendered - specify True to render this list.
*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.
.C
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.
.B
8
S
P
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.
A
E
Note: L
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
C Value Attribute property to a different value for each list. Setting this property to
Picklist
Athe same value for both lists will result in undesirable behaviour, such as causing the
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
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.
http://oracleapps88.blogspot.com/
Raju Ch
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.
About StackLayout, rowLayout, cellFormat region styles
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)
.B
8
S
P
|--------stackLayout region
P region
|-----rowLayout
|-----cellFormat region
A
region
E |------|-----tableitem1
L |-----cellFormat region(style: messageStyledText)
C
|------ table region
Set the properties for item1, item2 and item3. The properties are
Prompt
View Instance
.C
|------stackLayout region
|----rowLayout region
|----cellFormat region
|-----spacer (item style)
|
(width: 400)
|-----item (style: formattedText)
(Property Text: <b>Co: 101 XXX Energy Inc</b>)
http://oracleapps88.blogspot.com/
Raju Ch
View Attribute
(Please see table region in above screenshot for result)
How to display text items side by side
Solution:pageLayoutRegion
|-----stackLayout region
|----rowLayout region
|---------cellFormat region
|-------item (messageTextInput)
|---------cellFormat region
|-------item (style: spacer; width: 50)
.C
.B
8
S
P
A
ELAF (MLAF) -- generates "minimal" content to reduce the size of HTML
Minimum
L
pages and overall network overhead (for example, this LAF uses fewer images than the
C version)
BLAF
A
Oracle BLAF -- implements the Oracle Browser Look-and-Feel (BLAF) UI
Guidelines.
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.
Note: The LafConstants class is in the oracle.apps.fnd.framework.webui.laf package.
Example:
http://oracleapps88.blogspot.com/
Raju Ch
OA.jsp?page=/train/oracle/apps/ak/employee/webui/EmpDetailsPG&employeeNumber=
{@EmployeeId}&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)
From above screenshot, some text is showing in green color. Try for blaf and
oaText LAFs like above.
.C
.B
8
S
P
A
E
http://oracleapps88.blogspot.com/
Raju Ch
|
|---create column
|
|---create item (style: messageTextInput;
Set the View Attribute property)
|---create column header (to display heading of the
Column and sort the data)
Set the prompt property in column header properties to display heading of the column
(example: Employee Name)
Set the property Sort by View Attribute to sort the data based on column.
(Ex: - if Sort by View Attribute property value is EmployeeId, then sort the data
based on EmployeeId attribute.)
See below screen shot for reference.
Design the table with other columns like above.
O
L
public void processRequest(OAPageContext pageContext,
.B OAWebBean webBean)
{
super.processRequest(pageContext, webBean);
8
oracle.apps.fnd.framework.OAApplicationModule
am =
8
pageContext.getApplicationModule(webBean);
S
am.invokeMethod("initQueryAdv");
P
//create row and execute query
P
}
A
Go to the corresponding
Application Module and write below code to create row and
E
executeL
query.
(i.e. pagelayout region AM Definition property value)
C
Aimport oracle.jbo.Row;
Create controller (EmpAdvancedCO) on PageLayout Region.
.C
http://oracleapps88.blogspot.com/
Raju Ch
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.
.C
Select the tableFooter1 and press right mouse button and select the option
addTableRow. See below screenshot.
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.
.B
We need to set one property Total Value
as True for salary column (column4 in
8
below screen shot) and run the page.
8final output of advancedTable. (Add Another Row
See the below screenshot to know
the
S
button, Recalculate button and total value for salary column)
P
After press the Add P
Another Row button, one blank record will be created. See below
screen shot.
A
E
User selects
L the Recalculate button to update the column total.
CThe total displays a double precision summation of all visible rows in the table.
Note:
A The total reflects only the current visible records and not all the records queried.
Code:
public void setItemDetailsSno()
{
OAViewObject vo = (OAViewObject)getCMCostchangeVO();
CMCostchangeVORowImpl row = null;
int fetchedRowCount = vo.getRowCount();
http://oracleapps88.blogspot.com/
Raju Ch
.C
insertIter.closeRowSetIterator();
}
See below screenshot and check the values of serial number
Check the values of serial number in above screen shot.
.B
How do display latest serial number
8dynamically while creating row
8 Method of Controller.
Write below code in proecessFormRequest
S
P
Code:
P
oracle.apps.fnd.framework.OAApplicationModule
am=pageContext.getApplicationModule(webBean);
A
OAAdvancedTableBean
tableBean =
E
(OAAdvancedTableBean)webBean.findChildRecursive("AdvancedtblRN");
L
if (tableBean.getName().equals(pageContext.getParameter(SOURCE_PARAM))
C&&
AADD_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.
http://oracleapps88.blogspot.com/
Raju Ch
Imp: Set the property insert rows automatically as False in addTableRow1 object
at footer of advanced table.
public void setSequenceNum()
{
SequenceNumberVOImpl seqvo=getSequenceNumberVO1();
int fetchedRowCount=seqvo.getRowCount();
RowSet rowset=seqvo.createRowSet("dd");
rowset.last();
rowset.next();
Row row=seqvo.createRow();
rowset.insertRow(row);
row.setAttribute("SERIALNUM",new Integer(fetchedRowCount+1));
rowset.closeRowSet();
}
.C
Result: Display Serial Number (transient attribute) according to current row position
dynamically after pressing 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.
How do delete a selected record of Advanced Table using Delete Switcher
Solution:First add Delete Switcher item onto advancedTable region.
From above screenshot,
1) The deleteSwitcher is a column of advancedTable region.
2) The DelSwitcher is a switcher under deleteSwitcher column.
(Set viewAttribute property to enable the deleteSwitcher item)
(Add the column in VO like below for deleteSwitcher. Check
below decode statement. Add this in VO)
decode(NVL(SequenceNumberEO.ON_HOLD_FLAG,'Y'),'Y',
'DeleteEnabled',
'DeleteEnabled') AS DELETE_SWITCHER
3) Set viewAttribute property as DeleteSwitcher
4) Create image item under case.
Set the imageID as DeleteDisabled
Set the imageURI property as deleteicon_disabled.gif
5) Create second image item under second case.
Set the imageID as DeleteEnabled (same as in VO)
Set the imageURI property as deleteicon_enabled.gif
6) Set the image items height and width as 24
7) Set the action property for DeleteEnabled image as fireAction and Event as
delete. Set the parameters property under Event property as below screenshot.
.B
8
S
P
A
E
See below screen shot, after press the Add Another Row button
http://oracleapps88.blogspot.com/
Raju Ch
From above screenshot, the value of Name is supplierNUM. It is used to get serial
number when user clicks the delete switcher at runtime.
Value: ${oa.SequenceNumberVO1.SERIALNUM} [it is SPEL]
After setting above properties, Write below code in Application Module for removing
the selected record.
public void deleteSupplier(String SupplierNumber)
{
int suppToDelete = Integer.parseInt(SupplierNumber);
OAViewObject vo = (OAViewObject)getSequenceNumberVO1();
SequenceNumberVORowImpl row=null;
int fetchedRowCount = vo.getFetchedRowCount();
System.out.println("fetchedRowCount " + fetchedRowCount);
RowSetIterator deleteIter = vo.createRowSetIterator("deleteIter");
if (fetchedRowCount > 0)
{
deleteIter.setRangeStart(0);
deleteIter.setRangeSize(fetchedRowCount);
for (int i = 0; i < fetchedRowCount; i++)
{
row = (SequenceNumberVORowImpl)deleteIter.getRowAtRangeIndex(i);
// Number primaryKey = row.getSupplierId();
Number primaryKey = row.getSERIALNUM();
if (primaryKey.compareTo(suppToDelete)==0)
{
row.remove();
//getTransaction().commit(); (if remove this comments,
then the record will be
removed from database)
break;
}
}
}
deleteIter.closeRowSetIterator();
}
Invoke above method from CONTROLLER. Write below code in
processFormRequest method of CONTROLLER.
.C
.B
8
S
P
A
E
http://oracleapps88.blogspot.com/
Raju Ch
.B
8
S
P
A
E
.C
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
http://oracleapps88.blogspot.com/
Raju Ch
View objects (for LOVs): package name should end with .lov.server
Page definitions & controllers: package name should end with .webui
.C
.B
8
S
P
A
E
Here are the steps for creating Employee create update page. I have modified the search
page created in previous post.
1) Create a new Entity Object (EO):
===================
Right click on emprec package and create a new entity object (This will open a wizard
having 5 steps).
Step 1
Package: xxcus.oracle.apps.fnd.emprec.schema.server
http://oracleapps88.blogspot.com/
Raju Ch
Name: XxEmployeeEO
Schema Object (in Database Object): EMPLOYEE
Click Next.
Step 2
Keeps default (all attributes selected). Click Next.
Step 3
If there is any primary key in DB table, then keep all defaults else select a primary key
(like empno). Click Next.
Step 4
Keep defaults and click on Next.
Step 5
Keep Generate Default View Object uncheked and click on Finish.
2) Create a new View Object (VO) based on EO created in (1):
====================
Right click > New View Object (This will open a wizard having 7 steps).
Step 1
Package: xxcus.oracle.apps.fnd.emprec.server
Name: XxEmployeeVO
Choose the radio button Updatable access through Entity Objects. Click Next.
Step 2
Select the xxcus.oracle.apps.fnd.emprec.schema.server.XxEmployeeEO from Available
list and shuttle it to Selected list. Click Next.
Step 3
Move all the columns except WHO columns (lastUpdateLogin, createdBy) to
Selected list from Available list attributes.
Click Next.
Keep defaults for step 4, 5 & 6.
Step 7
Select check boxes for Generate Java File for both View Object Class and View Row
Class. Click Finish.
Double Click on XxEmployeeAM and shuttle XxEmployeeVO from Available view
objects to Data Model.
(now there are two VO instances in AM :XxEmployeeSearchVO1 &
XxEmployeeVO1).
3) Edit Employee Search Page (XxEmployeeSearchPG):
====================
(This includes adding a create button at top & update icon on every row in search
result. Modified page will appear as below:)
.C
.B
8
S
P
A
E
http://oracleapps88.blogspot.com/
Raju Ch
.C
Step 1
Right click on pageLayoutRN and add a new region. Set properties as below:
Region Style: pageButtonBar
ID: pageBtnBarRN
Right click on pageBtnBarRN region and add a new item:
Item Style: submitButton
ID: createBtn
Prompt: Create Employee
Step 2
Right click on XxEmployeeSearchVO1 table region and add an item. Set the below
properties:
Item Style: Image
ID: updateImg
Prompt: Update
Image URI: updateicon_enabled.gif
Action Type: fireAction
Event: updateEvent
Parameters: it will open a new window. Add a parameter as below:
Name: p_empNum value: ${oa.XxEmployeeSearchVO1.Empno}
4) Create a new Update Create page:
====================
(Here user can either create a new employee or can update existing one. The page will
appear as shown below: ).
.B
8
S
P
A
E
http://oracleapps88.blogspot.com/
Raju Ch
.C
Right click emprec > New > Web Tier > OA Components > select Page item.
Click OK. (This will open a popup window)
We are creating Employee Create Update Page, so specify the details of page as below:
Name: XxEmployeeCreateUpdatePG
Package: xxcus.oracle.apps.fnd.emprec.webui
Create a new region under pageLayout of type header
Create another region under the header region using wizard
(This will open a wizard window having 4 steps):
Shuttle all the fields from available to selected attributes. Click Next.
.B
8
S
P
A
E
http://oracleapps88.blogspot.com/
Raju Ch
.C
.B
8
S
P
A
E
http://oracleapps88.blogspot.com/
Raju Ch
.C
.B
8
S
P
A
E
http://oracleapps88.blogspot.com/
Raju Ch
.C
.B
8
S
P
A
E
Finally, user can click on Save button to commit the data or Cancel to return back to
search page.
http://oracleapps88.blogspot.com/
Raju Ch
7.
8.
9.
10.
if (pageContext.getParameter("cancelBtn") != null) {
pageContext.forwardImmediately("OA.jsp?page=/xxcus/oracle/apps
/fnd/emprec/webui/XxEmployeeSearchPG", null, (byte)0, null, null, fal
se, null);
11.
}
12.
13.
if (pageContext.getParameter("saveBtn") != null) {
14.
15. /*Here we are performing commit operation
16.
and returning back to search page.
17.
Also we are fetching the updated/created
18.
emp num so we can display a message on search page*/
19.
20.
String savedEmp = am.invokeMethod("commit").toString();
21.
HashMap hm = new HashMap();
22.
hm.put("updated", "Y");
23.
hm.put("empUpdated", savedEmp);
24.
pageContext.forwardImmediately("OA.jsp?page=/xxcus/oracle/apps
25.
/fnd/emprec/webui/XxEmployeeSearchPG", null, (byte)0, null, hm, fals
e, null);
26.
}
27. }
.C
.B
8
S
P
A
E
http://oracleapps88.blogspot.com/
43.
44.
45.
46.
47.
48.
49.
Raju Ch
if ("Y".equals(pageContext.getParameter("updated"))) {
String updatedEmp = pageContext.getParameter("empUpdated");
throw new OAException("Employee Number " + updatedEmp +
" has been saved successfully.",
OAException.CONFIRMATION);
}
}
.C
.B
8
S
P
A
E
http://oracleapps88.blogspot.com/
Raju Ch
.C
.B
8
S
P
A
E
http://oracleapps88.blogspot.com/
Raju Ch
.C
.B
8
S
Pright click on region1 and create a new region using wizard.
Expand poHearderLov
LOV,
P
Step 1
A
select XxDemoDependentLovAM
from Application Module drop down and select
E in available view usages. Click Next.
XxPoHeaderLovVO1
Step 2 L
choose
C region style as table from drop down. Click Next.
Step 3
AShuttle all the fields from available to selected attributes. Click Next.
Also modify the prompt to make it more user friendly (like PO Header ID).
This will create an item PoHeaderId under XxPoHeaderLovVO1 table region.
Set search allowed property to TRUE for the item created.
lovMap1:
LOV region item: PoHeaderId
Return item: poHearderLov
Criteria item: poHearderLov
http://oracleapps88.blogspot.com/
Raju Ch
.B
8
S
P
A
E
.C
http://oracleapps88.blogspot.com/
Raju Ch
.C
.B
8
S
P
A
E
Now select a value (PO Header Id) from LOV1 such as 4 (as shown in above screenshot).
Perform a search on PO Line ID LOV. This will show only those lines whose header Id is
4.
Below is screenshot for the same:
http://oracleapps88.blogspot.com/
Raju Ch
.C
.B
UIX Framework provides a solution for8
this: Partial Page Rendering i.e. to re-render
8
only a limited portion of a page.
S
Working of PPR :P
==========================
P
PPR is a three step process:
A
1) Partial page
E event
L
Partial
page events are quite similar to full page events. However, there are two important
C
between partial and full page events. First, partial page events specify partial
Adifferences
page rendering-specific event parameters which are not present on the full page event
equivalents. For example, partial page events may include an event parameter which
identifies the set of partial targets, or nodes that should be re-rendered.
The second difference between partial page events an full page events is how the events
are sent. Unlike full page events, partial page events must be sent in a way which does
not force the browser to reload the current page. To implement this capability, UIX PPR
uses a hidden iframe as a communication channel between the browser and the web
application running on the middle-tier. Partial page events are sent by forcing a
navigation in the hidden iframe, which in turns causes a request to be sent to the
application on the middle-tier. Since the iframe is hidden, the process of sending a partial
http://oracleapps88.blogspot.com/
Raju Ch
page event and rendering partial page contents can take place behind the scenes, without
discarding the contents of the current page.
2) Partial Page Rendering Pass
When the partial page event is received by the application, the application responds by
determining the set of partial targets to render and performing the partial page rendering
pass. The partial page rendering pass is similar to a full page rendering pass. In both
cases, the UINode tree is traversed by calling render() on each node in the tree. However,
in the PPR case, only the contents generated by the partial targets are actually sent back
to the browser. All other contents are dropped. So, the partial page response is generally
much smaller, since only the modified contents are sent back to the browser.
.C
When the browser receives the partial page response, the new contents for each partial
target node are copied from the hidden iframe into the main browser window, replacing
the existing contents for each target node. For example, in the table navigation case,
rather than replacing the entire page, just the contents of the table itself are replaced.
Now lets create a simple page to implement PPR. In this page, there are 3 items
(employee number, employee name & job). I have attach a PPR event on employee
number field. Hence, user will enter the emp number and as soon as he tabs out, name
and job will populate on their respective fields without refreshing the page.
.B
8
S
P
A
2) Create aE
new view objects (VO):
==========================
L
Right click > New View Object (This will open a wizard having 7 steps).
C
AStep 1
Package: xxcus.oracle.apps.fnd.pprdemo.server
Name: XxPprDemoVO
Choose the radio button Read-only Access (as no DML operation).
Click Next.
Step 2
Enter the below query in Query Statement:
select EMPNO, ENAME, JOB from employee
Keep defaults for step3, 4, 5, 6 & 7 and click Finish. Save All.
http://oracleapps88.blogspot.com/
Raju Ch
.B
8
S
P
A
E
ApageLayout:
ID: pageLayoutRN
AM Definition: xxcus.oracle.apps.fnd.pprdemo.server.XxPprDemoAM
Window Title: PPR Demo Page
Title: PPR Demo
defaultSingleColumn:
ID: singleColRN
Text: Enter Employee Number
.C
http://oracleapps88.blogspot.com/
Raju Ch
.C
.B
8
S
P
A
E
http://oracleapps88.blogspot.com/
Raju Ch
We will capture populateFields event (PPR event) in PFR method of controller and call
the appropriate method from AMImpl class as shown in below code snippet:
public void processFormRequest(OAPageContext pageContext,
OAWebBean webBean) {
super.processFormRequest(pageContext, webBean);
OAApplicationModule am = pageContext.getRootApplicationModule();
if ("populateFields".equals(pageContext.getParameter(EVENT_PARAM))) {
String empNum = pageContext.getParameter("Empno");
if (!("".equals(empNum.trim()))) {
Serializable[] param = { empNum };
String result =
am.invokeMethod("firePprEvent", param).toString();
if ("N".equals(result)) {
throw new OAException("Please enter valid employee number.",
OAException.ERROR);
}
} else {
String empnum = null;
Serializable[] param = { empnum };
am.invokeMethod("firePprEvent", param);
throw new OAException("Please enter employee number",
OAException.ERROR);
}
}
}
Code for firePprEvent method in XxPprDemoAMImpl.java file:
public String firePprEvent(String empNum) {
try {
XxPprDemoVOImpl vo = getXxPprDemoVO1();
vo.setWhereClause(null);
vo.setWhereClauseParams(null);
vo.setWhereClause("EMPNO = :1");
vo.setWhereClauseParam(0, empNum);
vo.setMaxFetchSize(-1);
vo.executeQuery();
XxPprDemoVORowImpl row = (XxPprDemoVORowImpl)vo.first();
if (row == null) {
return "N";
}
} catch (Exception e) {
e.printStackTrace();
}
return "Y";
}
.C
.B
8
S
P
A
E
http://oracleapps88.blogspot.com/
Raju Ch
User will enter employee number and tabs out. This will auto-populate the other two
fields without full page refresh as shown below:
.C
I have one table region where I am creating 6 rows by default. Now I have a requirement
wherein after selecting one poplist, I want to fire a PPR event and disable that row. In this
case we have to tell OAF which row to use. We achieve this using rowReference. If
anyone have similar requirement, try to use below code or get back to me.
.B
8
String event = pageContext.getParameter("
8
event");
S
if (("clause").equals(event)) {
Pevent source row
// Get the identifier of the PPR
String rowReference P
=
pageContext.getParameter(OAWebBeanConstants.EVENT_SOURCE_ROW_REFEREN
A
CE);
Eparameters = { rowReference };
Serializable[]
L
am.invokeMethod("nonEditable", parameters);
}C
A
In controller class:
In Application Module:
http://oracleapps88.blogspot.com/
Raju Ch
if ("ENDIF".equals(row.getAttribute("Condition"))||
"ELSE".equals(row.getAttribute("Condition")) ) {
row.setAttribute("transfielddisable", Boolean.TRUE);
System.out.println("disabling field");
}
} catch (Exception e) {
}
}
.C
.B
8
S
P
A
E