Documente Academic
Documente Profesional
Documente Cultură
2
Dynamic LOV................................................................................................................................5
Creating and Using Custom CSS for OAF Page Fields................................................................6
Dynamically Changing CSS Style of the OAF Page fields..........................................................7
Forwarding control between pages using Controller code............................................................8
Dynamic SQL or PL/SQL Execution in Controller....................................................................12
Executing Dynamic SQL:........................................................................................................12
Executing Dynamic PL/SQL:..................................................................................................13
Submitting Concurrent Request using Controller Code..............................................................14
Query Region for Creating Sample Search OAF Pages..............................................................15
Partial Page Rendering (PPR)......................................................................................................16
DFF in OAF Page........................................................................................................................22
Debugging OA Framework.........................................................................................................24
OAException Message and Dialog Page in OA Framework......................................................26
Extending the PageLayoutRN of a Page in OAF........................................................................29
Dependent LOV Creation
Requirement:
Here supplier sites LOV should be populated depend on the Supplier LOV Field value. If we tried to
select Supplier site LOV without selecting Supplier Name error should be shown as below.
Approach:
We can do it without using any code and by just using LOV Map items of LOV fields.
It controls the LOV Region Search results depend on the value of item given in Criteria Item property.
Corresponding LOV Region item will be restricted based on the value in Criteria Item Field.
If the value is true: Value is mandatory in Criteria Item Field, i.e. the item referred in Criteria Item
property should have value before LOV gets populated(Conducting Search).
If the value is false: Value is not mandatory in Criteria Item Field, i.e. we can conduct a search for
LOV Item even the item referred in Criteria Item property has null value.
If Criteria Item property has no value (i.e. not assigned with any item) Required Property of LOV
Map will be ignored.
2
Steps to approach the requirement:
Use FormVlaue item style for SupplierID field as we are not showing the SupplierID in our page.
1) Create Supplier LOV Item and do LOV mappings for necessary fields like SupplierName and
SupplierID.
a. Mappings under Supplier LOV
i. SupplierName Map:
LOV Region Item : SupLovRN_SupplierName
Return Item : PageRN_SupplierName
Criteria Item : PageRN_SupplierName
Required : False
2) Create Supplier Site LOV Item and do LOV mappings for necessary fields like
SupplierSiteName.
i. SupplierSiteName Map:
LOV Region Item : SupSiteLovRN_SupplierSiteName
Return Item : PageRN_SupplierSiteName
Criteria Item : PageRN_SupplierSiteName
Required : False
3
Criteria Item : Null
Required : False
3) Creating a Special mapping under Supplier Site LOV to make it as dependent on Supplier
LOV.
a. Special LOV Mapping:
LOV Region Item : SupSiteLovRN_SupplierID
Return Item : Null
Criteria Item : PageRN_SupplierID
Required : True
4
Dynamic LOV
We can modify the search results by changing the Where clause of VO Object assigned to the LOV
Region fields. We should use Java code to modify the where clause of VO Object.
Example Code:
5
Creating and Using Custom CSS for OAF Page Fields
b. Using in Personalization:
<style selector=".TNCUSCapsField">
<includeStyle name="DefaultFontFamily"/>
<property name="text-transform">uppercase</property>
</style>
Output:
Irrespective caps lock button, we can enter only capital letters in the field.
6
Dynamically Changing CSS Style of the OAF Page fields
(Using Controller Code)
Example Code:
OrgFNBean.setCSSClass ("OraDataText");
Here OraDataText is standard CSS definition given by Oracle. Here we can use custom CSS
definitions (defined in custom.xss file) also.
Example Code:
OrgFNBean.setInlineStyle (customUnCss);
7
Forwarding control between pages using Controller code
Parameters:
url - The URL to forward to. Example: OA.jsp?page=/oracle/apps/po/webui/myPage
functionName - This is the function name representing the page you want to forward to. If its
null, an IllegalArgumentException will be thrown. Also if the function is not under the current
HOMEPAGE a OAException will be thrown.
8
menuName - The name of the HOMEPAGE menu to reset the Menu context to when the
menuContextAction is OAWebBeanConstants.RESET_MENU_CONTEXT. If the menuName is
not of type HOMEPAGE a OAException will be thrown. You can pass null otherwise.
parameters - HashMap of parameter name/value pairs to append to the forward URL. The
final forward URL parameters are in the following sequence:
It will first get the function's corresponding URL call by querying the function
information from the database. If the user is not authorized to execute this function, a
security OAException will be thrown.
It will then append all parameters passed in the parameters HashMap. First
parameter added to the HashMap will be first added to the URL. Also the framework
will encode all parameter values before appending them to the URL.
It will remove all parameters if they have null values in the passed parameters
HashMap. This provides an easy way for developers to set a certain parameter's value
to null if they want to remove it.
It will remove any OA Framework internal URL parameters such as bcrumb,
retainAM, and so on..
Usage Notes: Abide by the following rules to use this map correctly.
If you do not want a parameter value on the request after the JSP
Forward, then pass in the parameter name with a null value to the parameters
HashMap of the setForward* or forwardImmediately* call -- this removes the
parameter in the forward target page's form action URL and also has the effect of
masking the parameter in the request object (passed in through a submitted form
value or OAPageContext.putParameter).
If you want to replace a parameter value upon JSP forward (for instance,
because you have a dynamically changing information like "poReg=x" which
determines which dynamic region to render in the forward target page), then again
pass in the parameter with the new value ("poReg=y") to the parameters HashMap but
make sure that the parameter is NOT part of the seeded function URL or the url
(method parameter) that you pass into the setForward* or forwardImmediately* call --
this way, the latest parameter change correctly takes effect in the forward target page.
retainAM - If true, all the cached application modules will be retained. If false, all the cached
application modules will be released. Developers must use this parameter to control the
release behavior of the cached appplication modules. This method will ignore any
retainAM=true or retainAM=false as a URL parameter or as part of parameters.
9
OAWebBeanConstants.ADD_BREAD_CRUMB_NO: clears the in memory
breadcrumb list.
OAWebBeanConstants.ADD_BREAD_CRUMB_SAVE saves/preserves the in
memory breadcrumb list as is.
OAWebBeanConstants.ADD_BREAD_CRUMB_RESTART In memory
breadcrumb list is cleared and then the current forward URL is immediately added to
the empty breadcrumb list (this mode has the effect of
OAWebBeanConstants.ADD_BREAD_CRUMB_NO plus
OAWebBeanConstants.ADD_BREAD_CRUMB_YES).
OAWebBeanConstants.ADD_BREAD_CRUMB_REPLACE: searches for the
first breadcrumb item in the in memory breadcrumb list that has the same breadcrumb
label as that you try to add into the list. If such an item is found, the URL value of the
breadcrumb item found is replaced with the current forward URL, and the breadcrumb
list is rewound to the breadcrumb item found -- that is, all the items after the found item
are removed from the list. Otherwise, (if the item is not found), a new breadcrumb item
is added to the existing breadcrumb list -- same effect as in
ADD_BREAD_CRUMB_YES.
Each breadcrumb item in the in memory breadcrumb list is uniquely identified by its displayed
breadcrumb label/text (defaulted to page title except for the first breadcrumb that is based on
the menu selection) within an application. Within the same application, breadcrumb label
should not repeat in the displayed breadcrumb list.
Note: If you plan to call setForwardURL method before throwing an exception, then you should
determine whether you want to ignore the messages and forward or to show the messages in
the current page and stop the forward.
Throws:
OAException -
10
IllegalArgumentException -
Example Code:
pageContext.setForwardURL
("OA.jsp?page=/ssl/oracle/apps/fnd/util/webui/EmployeeCreatePG ",
null,
OAWebBeanConstants.REMOVE_MENU_CONTEXT,
null, null, true,
OAWebBeanConstants.ADD_BREAD_CRUMB_YES,
OAWebBeanConstants.IGNORE_MESSAGES);
OR
pageContext.forwardImmediately
("OA.jsp?page=/ssl/oracle/apps/fnd/util/webui/EmployeeCreatePG ",
null,
OAWebBeanConstants.REMOVE_MENU_CONTEXT,
null, null, true,
OAWebBeanConstants.ADD_BREAD_CRUMB_YES);
11
Dynamic SQL or PL/SQL Execution in Controller
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.jdbc.OraclePreparedStatement;
import oracle.jdbc.OracleResultSet;
import oracle.apps.fnd.framework.server.OADBTransaction;
import java.sql.SQLException;
Step2:
In the processrequest method after the super.processRequest (pageContext, webBean);
line write the following lines of code.
Step3:
As shown below prepare the required SQL statement using variable type StringBuffer.
Step4:
Just write the code as below to execute SQL and get the output of SQL.
try
{
OraclePreparedStatement oraclePreparedStatement = null;
OracleResultSet oracleResultSet = null;
oraclePreparedStatement = (OraclePreparedStatement)
oadbTransaction.createPreparedStatement (stringBuffer.toString (), 1);
}
catch (Exception sqlexception)
{
pageContext.putDialogMessage (new OAException ("OraclePreparedStatement OR
OracleResultSet Exception"));
sqlexception.printStackTrace ();
}
12
Executing Dynamic PL/SQL:
Generally we use this method to call PL/SQL procedure from controller.
Step1:
Import the following packages into your controller.
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.server.OADBTransaction;
import oracle.jdbc.OracleCallableStatement;
import java.sql.SQLException;
Step2:
In the processrequest method after the super.processRequest (pageContext, webBean);
line write the following lines of code.
Step3:
As shown below prepare the required PLSQL statements using variable type StringBuffer.
Step4:
Just write the code as below to execute PLSQL.
try
{
callablestatement.execute ();
callablestatement.close ();
}
catch (SQLException e)
{
System.out.println (The Error is + e);
}
13
Submitting Concurrent Request using Controller Code
Step1:
Import the following packages into your controller.
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.server.OADBTransaction;
import oracle.apps.fnd.cp.request.ConcurrentRequest;
import oracle.apps.fnd.cp.request.RequestSubmissionException;
import java.util.Vector;
Step2:
In the processrequest method after the super.processRequest (pageContext, webBean);
line write the following lines of code.
Step3:
Just write the code as below to submit the required concurrent program.
try
{
java.sql.Connection pConncection = dbtrans.getJdbcConnection();
ConcurrentRequest cr = new ConcurrentRequest(pConncection);
String applnName = "TNC"; //Concurrent Program Application Short name
String cpName = "TNAPSOBR"; //Concurrent program name
Vector cpParameters = new Vector (); // Parameters of concurrent program
cpParameters.addElement(l_param);
requestId = cr.submitRequest(applnName, cpName, "", "", false, cpParameters);
System.out.println("Testing -->"+requestId);
dbtrans.commit();
}
catch (RequestSubmissionException e)
{
throw new OAException(e.toString(),OAException.ERROR);
}
14
Query Region for Creating Sample Search OAF Pages
A query region is basically an extension of the stackLayout region.
The results of a query are rendered using either a HGrid or a table. The table or HGrid elements are
added as indexed children of the query region.
A query region can have three types of search panels as listed below.
Simple
Advanced
Customize
Default mode: Developer is responsible for defining the search panels and binding the results of the
search to the results table/HGrid.
Results Based Search (RBS) mode: Search panel is created dynamically using the queryable property
of the region items inside the nested table or HGrid indexed children
Auto Customization Criteria (ACC) mode: You have the flexibility of defining your own UI for the search
panels, but the binding is powered by the framework as long as items on the panels are mapped to
items in the results table/HGrid.
Set the User Personalization property of the table/hgrid region (under the query region) to True if you
want to support user-personalizable searches which are surfaced in a Views panel.
15
Partial Page Rendering (PPR)
A mechanism for selectively refreshing parts of a page (as opposed to the whole page) in response to
user actions. For example, if a user sorts a table, only the table's contents changes; the rest of the
page remains the same.
The FND: Disable Partial Page Rendering profile option must be set to No. If this profile value is set to
Yes, a Go button renders next to each item you configure to raise a PPR event).
Note: UIX currently does not support the ability to hide components whose direct parent region is a
cellFormat or a rowLayout. As a workaround, to hide a component such as a button in a cellFormat,
add flowLayout to your cellFormat region first, and then add the button to the flowLayout
You need to set this syntax on the attribute on which you want to enable PPR in the Parameters
window. At runtime, this item will render according to the value of the EmpManagerRender attribute in
the EmployeePVO1 view object.
To enable PPR on page, you must create an OA Framework standard applications properties view
object (PVO) including a transient attribute for tracking the state of the visible property for the Attribute.
The application properties view object should be created in the same package as your module's other
UI BC4J components. Note that you should have only one application properties view object per
application module (it can include attributes used by different pages that share the same root UI
application module).
Example:
Now we will try to implement partial page rendering for a text item.
If value of TextItem1 is null then TextItem2 will not be appreared on UI.
If value of TextItem1 is not null then TextItem2 will be appreared on UI.
16
3. Create a PPRVO View Object
PPRDemoProj> New > ADF Business Components > View Objects
Name PPRVO
Package test.oracle.apps.fnd.pprdemo.server
In Attribute Page
Click on New button and create transient primary key attribute with the following properties:
Attribute Property
Name RowKey
Type Number
Updateable Always
Click New button again and create transient attribute with the following properties:
Attribute Property
Name TextItem2Render
Type Boolean
Updateable Always
17
6. Modify the Page Layout (Top-level) Region
Attribute Property
ID PageLayoutRN
AM Definition test.oracle.apps.fnd.pprdemo.server.PPRAM
Attribute Property
ID MainRN
Attribute Property
ID TextItem1
Length 20
18
Disable Server Side Validation True
Event TextItem1Change
Submit True
Note -- Disable Client Side Validation and Event property appears after you set the Action Type
property to firePartialAction
Attribute Property
ID TextItem2
Length 20
Rendered ${oa.PPRVO1.TextItem2Render}
import oracle.apps.fnd.framework.OARow;
import oracle.apps.fnd.framework.OAViewObject;
import oracle.apps.fnd.framework.server.OAApplicationModuleImpl;
import oracle.apps.fnd.framework.server.OAViewObjectImpl;
public void handlePPRAction()
{
Number val = 1;
OAViewObject vo = (OAViewObject)findViewObject("PPRVO1");
if (vo != null)
{
if (vo.getFetchedRowCount() == 0)
{
vo.setMaxFetchSize(0);
vo.executeQuery();
vo.insertRow(vo.createRow());
19
OARow row = (OARow)vo.first();
row.setAttribute("RowKey", val);
row.setAttribute("TextItem2Render", Boolean.FALSE);
}
}
}
import oracle.apps.fnd.framework.OARow;
import oracle.apps.fnd.framework.OAViewObject;
am.invokeMethod("handlePPRAction");
}
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processFormRequest(pageContext, webBean);
PPRAMImpl am = (PPRAMImpl)pageContext.getApplicationModule(webBean);
OAViewObject vo = (OAViewObject)am.findViewObject("PPRVO1");
OARow row = (OARow)vo.getCurrentRow();
if ("TextItem1Change".equals(pageContext.getParameter(EVENT_PARAM)))
{
if (pageContext.getParameter("TextItem1").equals(""))
{
row.setAttribute("TextItem2Render", Boolean.FALSE);
}
else
{
row.setAttribute("TextItem2Render", Boolean.TRUE);
}
}
}
Output Screens:
20
21
DFF in OAF Page
1) CacheComponent not registered (KEY=FLEXFIELD_METADATA_CACHE)
(APP=FND) Error Resolution:
Name -- FLEXFIELD_METADATA_CACHE
Code -- FLEXFIELD_METADATA_CACHE
Application Name -- Application Object Library
Description -- Stores descriptive flexfield, key flexfield, and value set metadata.
Loader Class Name -- oracle.apps.fnd.flexj.FlexfieldCacheLoader
Business Event Name
--oracle.apps.fnd.flex.dff.compiled;oracle.apps.fnd.flex.kff.structure.compiled;oracle.apps.fnd.flex.vst.up
dated
2) Important Flex bean item style Properties and Values to Use DFF in OAF
Page:
General:
Item Style: flex
BC4J:
View Instance: VO Object name which should be based on DFF related Table.
Flexfields:
Appl Short Name: <Application Short Name of DFF>
Name: <DFF Name>
Type: descriptive
SegmentList: <List Segments should be shown>
DisplayContextField: True or False
Displayable Segments List Syntax for Segments List property of flex bean item:
You can add the read-only token ($RO$) suffix to the segment you want to render as read only.
22
3) Changing DFF Segment List or DFF Structure dynamically:
DFF Reference field concept will not work in OAF.
So we should use PPR to change DFF Context depend on some existing field of OAF Page.
Example:
Here we are changing the Job DFF Context Depend on the parameter JobContext.
Controller Code:
Required Packages:
import oracle.apps.fnd.framework.webui.beans.OADescriptiveFlexBean;
if (pageContext.getParameter("JobContext")!= null)
{
// Code used to change the Job DFF context name dynamically
// changing DFF Context means page definition or structure will get changed so we should use
// below code in processRequest method of controller.
OADescriptiveFlexBean jobDFF=(OADescriptiveFlexBean)webBean.findChildRecursive("JobDFF");
// Getting the object
// reference of required DFF flex bean
jobDFF.setFlexContextCode(pageContext,pageContext.getParameter("JobContext"));
jobDFF.processFlex(pageContext);
23
Debugging OA Framework
Some of these techniques are applicable when running the Framework pages from jDeveloper,
whereas other debugging techniques apply when debugging OA Framework Pages from eBusiness
Suite responsibility.
Each method of debugging OA Framework pages has its own merits, and hence you must apply one of
the techniques that suites the most to your situation.
1. Use System.out.println
When running the OA Framework pages from jDeveloper itself, you can write debug messages using
System.out.println.
These debug messages will be displayed in the console of jDeveloper.
Advantages:
* Ease of use, as you simply enter free text messages
* Debug messages simply appear without the need to set any profile options
Disadvantages:
* Too much typing, which can be avoided when using the debugger of jDeveloper.
* You can debug only those pieces of code that you suspect are causing the error. Unlike to this
approach, using jDeveloper debugging, breakpoints can be set for exceptions/classes as well.
2. Use the FND Debug Logging feature, to see debug messages on the OA Framework Screen
itself
The debug messages can either been seen on the same screen or those can be spooled into a table
named FND_LOG_MESSAGES
In jDeveloper, you must include OADiagnostic in the Run Options.
This is effectively similar to setting profile option FND Diagnostics to Yes in eBusiness Suite.
Using this option, you will be able to click on Diagnostics to enable On-Screen display of debug
messages.
Advantages:
* The debug messages seen using this technique are exactly the same as the debug messages
seen in eBusiness Suite, once FND%Log% profile options are available.
* There is tremendous amount of debug messages in FND classes given by Oracle.
* This approach is the most useful when investigating red coloured error message Please contact
your system administrator
Disadvantages:
* Prior to 11.5.10, this option might bring your application session down to its knee. But I notice
from 11.5.10 onwards, these debug messages are captured very efficiently.
* The debugging is limited to the debug messages in place. To maximise the listing of debug
messages, try to use statement level debugging.
24
For jDev, ensure that OA Diagnostics has been included in jDeveloper Project property Run Options.
Alternately ensure that profile option FND Diagnostics has been setup against your username.
4. Use FND Logging profile options to capture debug messages into a table named
FND_LOG_MESSAGES
Use the FND Debug Logging feature, to see debug messages.
The debug messages can either been seen on the same screen or those can be spooled into a table
named FND_LOG_MESSAGES
5. Use raiseDeveloperException.
You can raise debug messages to be displayed in OA Framework pages using
raiseDeveloperException.
By doing so, your debug messages will be visible onto the top portion of the screen.
This is very similar to System.out.println, however the key difference being that
raiseDeveloperException displays the debug message on top portion of the page itself.
Advantages:
* Ease of use, as you simply enter free text messages
* Debug messages simply appear without the need to set any profile options
* Debug messages appear on the top portion of the page and hence the ease of visibility when
testing your code in jDeveloper
Disadvantages:
* Too much typing, which can be avoided when using the debugger of jDev.
* You can debug only those pieces of code that you suspect are causing the error.
25
OAException Message and Dialog Page in OA Framework
You can use OAException (or any of its subclasses) to display a message on an OA Framework page
and the OA Framework automatically displays an error message at the top of the current page.
You can display the following standard kinds of messages at the top of a page:
1. Error
2. Warning
3. Confirmation
4. Information
You can explicitly display a message box of any type using the following code in your controller.
Code:
OAException message = new OAException("You cannot create a new change order when a Draft
version already exits.",OAException.ERROR);
pageContext.putDialogMessage(message);
Here you need to construct an oracle.apps.fnd.framework.OAException object and set the kind of
message you want (other options are OAException.WARNING, OAException.INFORMATION and
OAException.CONFIRMATION). Then you can simply identify this exception for display when the page
renders by calling the OAPageContext.putDialogMessage() method.
if after you call putDialogMessage() in your processFormRequest() method you want to forward
to the current page or another page and display the message at the top of the new target page, you
need to call the appropriate oracle.apps.fnd.framework.webui.OAPageContext forwardImmediately*()
method. The OA Framework immediately stops processing the page and issues a forward before
displaying the messages.
You can register or throw multiple exceptions; the OA Framework combines them into a single
message box using the following rules:
1. Since an error is more important than a warning, the message box is titled Error if both errors
and warnings exist.
2. Confirmations and errors cannot be shown together. In this case, the OA Framework simply
ignores the confirmation message(s).
3. You can, however, show confirmations with warnings. The message box is titled
Confirmation, and it contains both types of messages.
Example -
ArrayList errMsg = New ArrayList();
errMsg.add(new OAException("Msg1"));
errMsg.add(new OAException("Msg2"));
errMsg.add(new OAException("Msg3"));
OAException.raiseBundledOAException(errMsg);
26
Output
1. Msg1
2. Msg2
3. Msg3
Exception - If above method is being implemented inside a try/catch block, It might not throw expected
error message.So either implement above outside Try/catch block or use below steps to handle this
inside try/catch.
2) Define the messages inside the try block and raise exception with custom message
try {
errMsg.add(new OAException("Who is Lucifer"));
errMsg.add(new OAException("Ra-One will kill Lucifer"));
errMsg.add(new OAException("G-One is protector"));
throw new OAException("Sandeep");
}
The OADialogPage class holds properties for the generic dialog page. To create a dialog page object,
first use the constructors to instantiate the basic properties, then use the setter methods provided in the
class to set additional properties.
To navigate (redirect) to a dialog page, use the OAPageContext.redirectToDialogPage methods. The
OAPageContext interface contains the context and state information specific for a client request.
Example Code:
// To Diaplay the Exception on a Dialog page
OAException message = new OAException("You cannot create a new change order when a Draft
version already exits.");
27
OADialogPage dialogPage = new OADialogPage(OAException.ERROR, message, null, "",null);
dialogPage.setOkButtonToPost(true);
dialogPage.setOkButtonLabel("Ok");
dialogPage.setPostToCallingPage(true);
java.util.Hashtable formParams = new java.util.Hashtable(1);
dialogPage.setFormParameters(formParams);
pageContext.redirectToDialogPage(dialogPage);
If you want 2 buttons (Say Cancel and Ok), then put instead of null in the OADialogPage dialogPage
= new OADialogPage line.
28
Extending the PageLayoutRN of a Page in OAF
Generally we will have requirement like using existing Page definition or Region definitions for many
times. In such cases extends property of Page or Region will be useful. If we need to hide or create
any items in extending page we can do it by controller code of Page or Region. Now we will see how to
extend the existing page definition.
3. Search for the region under a particular package where the original page is present.
4. Un-check the Show components with Valid scope only and click Search.
5. You can see the PageLayoutRN of all the pages present in that particular package.
6. You can select the original page and you should be able to see the whole page structure in the new
page.
29