Beruflich Dokumente
Kultur Dokumente
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
Approach:
We can do it without using any code and by just using LOV Map items of LOV fields.
: LOVInput Field
: FormValue Field
: LOVInput Field
: FormValue Field
: Display Field
: FormValue Field
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
Return Item
Criteria Item
Required
: SupLovRN_SupplierName
: PageRN_SupplierName
: PageRN_SupplierName
: False
: SupLovRN_SupplierID
: PageRN_SupplierID
: Null
: False
2) Create Supplier Site LOV Item and do LOV mappings for necessary fields like
SupplierSiteName.
a. Mappings under Supplier LOV
i. SupplierSiteName Map:
LOV Region Item
: SupSiteLovRN_SupplierSiteName
Return Item
: PageRN_SupplierSiteName
Criteria Item
: PageRN_SupplierSiteName
Required
: False
ii. SupplierSiteID Map:
LOV Region Item
: SupSiteLovRN_SupplierSiteID
Return Item
: PageRN_SupplierSiteID
Criteria Item
Required
: Null
: 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
In this Special Map we are referring criteria item as PageRN_SupplierID and
Required property is true so before populating Supplier Site LOV we should
Have value in PageRN_SupplierID, i.e. we should select Supplier using Supplier LOV and
while conducting search in Supplier Site LOV SupSiteLovRN_SupplierID field will be
restricted based on PageRN_SupplierID field.
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.
Steps to change where clause of VO Object:
1) Create a new controller for LOV Region.
2) Write the required code in processRequest method of controller as LOV values should be
restricted when LOV region is loading.
3) Get the reference of required VO Object using Application Module of Page and assign it to
local variable.
4) Change the where clause definition of VO Object using inbuilt method setWhereClause ().
5) Set the each parameter depend on where clause definition using VO Object inbuilt method
setWhereClauseParam ().
6) Should call VO Object inbuilt method executeQuery () to effect the where clause changes.
Example Code:
// getting the reference of required VO Object
OAApplicationModule am = pageContext.getApplicationModule (webBean);
OAViewObject empVO = (OAViewObject) am.findViewObject ("EmpVO1");
// changing where clause VO dynamically
empVO.setWhereClause (" DEPTNO = nvl (:1, DEPTNO) ");
empVO.setWhereClauseParam (0, deptNo)
empVO.executeQuery ();
b. Using in Personalization:
Output:
Irrespective caps lock button, we can enter only capital letters in the field.
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.
menuContextAction - Determines the behavior of the MenuContext after forwarding to the
new page. It accepts the following values:
OAWebBeanConstants.KEEP_NO_DISPLAY_MENU_CONTEXT_RETAIN_G
LOBAL_BUTTONS: Keeps the menu context as is, but will not display all menus
excluding global buttons.
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.
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.
addBreadCrumb - Controls breadcrumbs behavior. Possible values are:
OAWebBeanConstants.ADD_BREAD_CRUMB_NO: clears the in memory
breadcrumb list.
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).
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
12
13
Step2:
In the processrequest method after the super.processRequest (pageContext, webBean);
line write the following lines of code.
OAApplicationModule am = pageContext.getApplicationModule (webBean);
OADBTransaction dbtrans = am.getOADBTransaction ();
int requestId;
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
15
16
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
Key Attribute
(Checked)
Click New button again and create transient attribute with the following properties:
Attribute
Property
Name
TextItem2Render
Type
Boolean
Updateable
Always
17
Attribute
Property
ID
PageLayoutRN
Region Style
pageLayout
Form Property
True
Auto Footer
True
Window Title
Title
AM Definition
test.oracle.apps.fnd.pprdemo.server.PPRAM
Attribute
Property
ID
MainRN
Region Style
messageComponentLayout
Create First messageTextItem -Right click on MainRN > New > messageTextInput
Attribute
Property
ID
TextItem1
Region Style
messageTextInput
Prompt
Text Item1
Length
20
18
True
True
Action Type
firePartialAction
Event
TextItem1Change
Submit
True
Note -- Disable Client Side Validation and Event property appears after you set the Action Type
property to firePartialAction
Create Second messageTextItem -Select MainRN right click > New > messageTextInput
Attribute
Property
ID
TextItem2
Region Style
messageTextInput
Prompt
Text Item2
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
import oracle.apps.fnd.framework.OARow;
import oracle.apps.fnd.framework.OAViewObject;
public void processRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processRequest(pageContext, webBean);
PPRAMImpl am = (PPRAMImpl)pageContext.getApplicationModule(webBean);
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
--Time To Live
--Global Idle Time
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
Syntax to control DFF Segment List:
Displayable Segments List Syntax for Segments List property of flex bean item:
Global Data Elements|[global segment1]|[global segment2]||...||Context1|[segment1 for context1]|
[segment2 for context1]||...||Context2|....
You can add the read-only token ($RO$) suffix to the segment you want to render as read only.
22
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.
3. SQL Trace for Oracle Framework Sessions
We often use this technique for tracing the SQL statements executed by Oracle Forms or by concurrent
programs.
The same technique can be applied to OA Framework too.
You can run the SQL*Trace either when running the application pages from OA Framework or when
running OA Framework pages from within eBusiness Suite.
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
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.
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.
1) Create array list object at global level
ArrayList errMsg = New ArrayList();
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");
}
3)
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
If you want 2 buttons (Say Cancel and Ok), then put instead of null in the OADialogPage dialogPage
= new OADialogPage line.
28
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