Dependent LOV Creation.......................................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
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Dependent LOV Creation..........................................................................................................2Dynamic LOV...........................................................................................................................5Creating and Using Custom CSS for OAF Page Fields............................................................6Dynamically Changing CSS Style of the OAF Page fields......................................................7Forwarding control between pages using Controller code........................................................8Dynamic SQL or PL/SQL Execution in Controller................................................................12
Submitting Concurrent Request using Controller Code..........................................................14Query Region for Creating Sample Search OAF Pages..........................................................15Partial Page Rendering (PPR).................................................................................................16DFF in OAF Page....................................................................................................................22Debugging OA Framework.....................................................................................................24OAException Message and Dialog Page in OA Framework..................................................26Extending the PageLayoutRN of a Page in OAF....................................................................29
Dependent LOV Creation
Requirement:
Consider we are having two LOVs in our page1) Supplier LOV2) Supplier Site LOV
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.
Important Properties of “LOV Map” Items:
“LOV Region item” Property of LOV Map:
“Return Item” Property of LOV Map:
It tells where to copy the selected LOV Region item value.
“Criteria Item” Property of LOV Map:
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””.
“Required” Property of LOV Map:
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.
SupLovRN_SupplierName : Display FieldSupLovRN_SupplierID : FormValue Field
Field created in Supplier Site LOV Region:
SupSiteLovRN_SupplierSiteName : Display FieldSupSiteLovRN_SupplierSiteID : 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 : SupLovRN_SupplierNameReturn Item : PageRN_SupplierName Criteria Item : PageRN_SupplierName Required : False
ii. “SupplierID” Map:LOV Region Item : SupLovRN_SupplierIDReturn Item : PageRN_SupplierIDCriteria Item : NullRequired : 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_SupplierSiteNameReturn Item : PageRN_SupplierSiteName Criteria Item : PageRN_SupplierSiteName Required : False
ii. “SupplierSiteID” Map:LOV Region Item : SupSiteLovRN_SupplierSiteIDReturn Item : PageRN_SupplierSiteIDCriteria Item : Null
3
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_SupplierIDReturn Item : Null Criteria Item : PageRN_SupplierIDRequired : 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.
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.
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 ObjectOAApplicationModule am = pageContext.getApplicationModule (webBean);
1. Take the existing custom.xss file from instance under $OA_HTML/cabo/styles.2. Add your new custom style definition between <styleSheet> and </styleSheet> elements.3. Example: <style selector=".CusOraFieldText">Arial <property name="font-family">Arial</property> <property name="font-weight">bold</property> <property name="font-size">9pt</property> <property name="color">#08B53C</property>
</style>4. Replace the custom.xss in the instance with modified custom.xss file (may require Apache
bounce).5. Usage of custom CSS in OAF Page definition or Personalization.
a. Using in New Custom Page Field:
b. Using in Personalization:
6. Style definition to lock caps for particular field:Add below style definition in $OA_HTML/cabo/styles/custom.xss file and use the custom CSS definition name to required field.
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_MENU_CONTEXT : Keeps the menu context as is. OAWebBeanConstants.KEEP_NO_DISPLAY_MENU_CONTEXT : Keeps the menu
context as is, but will not display all menus including global buttons. OAWebBeanConstants.KEEP_NO_DISPLAY_MENU_CONTEXT_RETAIN_GLOBA
L_BUTTONS: Keeps the menu context as is, but will not display all menus excluding global buttons.
OAWebBeanConstants.REMOVE_MENU_CONTEXT : Removes the menu context OAWebBeanConstants.GUESS_MENU_CONTEXT : Selects the given functionName
function if it exists in the current menu. If not it will try to make a guess by moving up the menu tree until it finds it. An exception will be thrown if the function could not be located.
OAWebBeanConstants.RESET_MENU_CONTEXT : Reset the menu context to the given functionName and menuName.
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.
addBreadCrumb - Controls breadcrumbs behavior. Possible values are: OAWebBeanConstants.ADD_BREAD_CRUMB_YES : creates a breadcrumb item for
the forwarded page and adds it to the in memory breadcrumb list. If the in memory breadcrumb list already contains a breadcrumb item with the same breadcrumb label as that you try to add into the list, breadcrumb list will be rewound to the breadcrumb item found -- that is, all the items after the found item will be removed from the list, and breadcrumb will not be added twice for the same label. The associated URL value of the existing breadcrumb item found will not be changed. If two pages have the same breadcrumb label (defaulted to page title except for the first breadcrumb that is based on the menu selection), but if they are under different applications, they will be treated as different pages and hence different breadcrumbs.
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
9
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.
If the addBreadCrumb is not one of the above constants, an IllegalArgumentException will be thrown.
For more information on breadcrumbs, see Breadcrumbs Coding Guidelines document.
messagingLevel - Used to determine if the forward should be cancelled if messages or exceptions of level Error, Warning, Confirmation, or Information are found. Note all messages present will be shown regardless of the level. Possible values are:
OAWebBeanConstants.IGNORE_MESSAGES : the page will be forwarded even if exceptions or messages exist.
OAException.ERROR : cancels the forward if there is at least one error message or exception.
OAException.WARNING cancels the forward if there are any warnings or error messages or exceptions.
OAException.INFORMATION cancels the forward if there are errors, warnings, information type messages or exceptions.
OAException.CONFIRMATION cancels the forward if there are errors, warnings, information, or confirmations type messages or exceptions.
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 -
If the user is not authorized to execute functionName. If the menu context is to be altered and either menuName is not a defined
HOMEPAGE or functionName is not under the HOMEPAGE.
IllegalArgumentException - If the passed addBreadCrumb is illegal.
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 nameString cpName = "TNAPSOBR"; //Concurrent program nameVector 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.
A query region can contain the following:1. Simple search panel2. advanced search panel3. a results table4. Other elements as indexed children
Simple search panel can contain any of the following regionsa) defaultSingleColumnb) defaultDoubleColumnc) defaultStackd) defaultFormStack elements.
The advanced search panel can contain a) advancedSearch element.
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.SimpleAdvancedCustomize
Also the query region runs in three modes: 1. Default mode 2. Results Based Search (RBS) mode3. Auto Customization Criteria (ACC) mode.
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.
Corresponding web bean: OAQueryBean
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).
We use SPEL (Simplest Possible Expression Language) for PPR actions.
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.
1. Create a New OA Workspace and Empty OA Project
File> New > General> Workspace Configured for Oracle Applications
File Name -- PPRProj
Project Name – PPRDemoProj
Default Package -- test.oracle.apps.fnd.pprdemo
2. Create Application Module AM
PPRDemoProj right click > New > ADF Business Components > Application Module
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); } } }
20
Output Screens:
21
DFF in OAF Page
1) CacheComponent not registered (KEY=FLEXFIELD_METADATA_CACHE) (APP=FND) Error Resolution:
“CacheComponent not registered (KEY=FLEXFIELD_METADATA_CACHE) (APP=FND)” error will come while running the OAF page which has flex bean in the page definition.We should do below setups to run an OAF page trough Jdeveloper, this has flex bean in page definition.
Click on Functional Developer responsibility->CoreServicesselect Application Object Library as Application name in the screen.Click on create component button and give the following details to create component.
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.updated
Time Out Type --Time To Live Time Out After --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: descriptiveSegmentList: <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
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”.
public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean);
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.printlnWhen 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 optionsDisadvantages: * 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 itselfThe debug messages can either been seen on the same screen or those can be spooled into a table named FND_LOG_MESSAGESIn 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 SessionsWe 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.For jDev, ensure that OA Diagnostics has been included in jDeveloper Project property “Run
24
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_MESSAGESUse 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 jDeveloperDisadvantages: * 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. Error2. Warning3. Confirmation4. 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.
Multiple Error Messages in OAF:
a. Create and initialize new ArrayList objectb. Define the error messages in array listc. Raise bundled eception method
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. Msg12. Msg23. Msg3Exception - 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) Handle this implementation inside the catch blockcatch(Exception e) { String a="oracle.apps.fnd.framework.OAException: Sandeep"; if (a.equals(e.toString())) { OAException.raiseBundledOAException(errMsg); } else { throw new OAException("Exception Has been found in code 28:" +e, OAException.INFORMATION); }
Show the Exception Message on a Dialog Page:
You can display an exception as a message in a dialog page using the APIs in the oracle.apps.fnd.framework.webui.OADialogPage class and oracle.apps.fnd.framework.webui.OAPageContext interface.
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.
Steps for Extending:
1. Create a new page. 2. in the structure pane click on the region1 and click on the Extends property.
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
Use can use new Control to dynamically change the structure. Other wise keep the controller defaulted due to extended region
Give the required the Page Layout Name or Region name to extend.Click on button to search open search window shown below.