Wednesday, August 6, 2014

Oracle Application Framework (OAF)


OA Framework is based on the industry-standard J2EE MVC Design Pattern.
                  M - Model
                  V - View
                  C - Controller

Developers manipulate the application’s 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.

The Model is where the application implements its business logic.

The View is where the application implements its user interface.

The Controller is where the application handles user interaction and directs business flow.

Find the following MVC diagram to understand relationship between Model, View and Controller.


1.1       About Model

The OA Framework Model is implemented using Oracle Business Components for Java (BC4J).

BC4J provides optimized, ready-to-use implementations of the J2EE design patterns.
Development teams can focus immediately and only, on writing business logic and user interfaces instead of designing, coding, and debugging handcrafted application “plumbing” code.


1.2       About View

The OA Framework View is implemented using UI XML (UIX).
UIX uses XML to describe the components and hierarchy that make up an application page.
UIX provides runtime capabilities to translate that metadata into HTML output so that it can be shown on a Browser.

The metadata used to describe the UI is loaded into a database repository, called Meta Data Services (MDS), at deployment time and optionally at design time as well.


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)

2.         Key Features

  • Integrated Development Environment
  • Durable Personalization’s 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.

2.2       Durable Personalization’s and Extensions

Personalization is about declaratively tailoring the UI look-and-feel, layout or visibility of page content to suit a business need or a user preference.

Personalization can be done at several levels by one of three authors:
  • Application Developer
  • Application Administrator
  • End User
  • Tailoring the color scheme of UI (UI means User Interface)
  • Tailoring the order in which table columns are displayed.
  • Tailoring a query result

Extensibility is about extending the functionality of an application beyond what can be done through personalization.

  • Adding new functional flows
  • Extending or overriding existing functional flows
  • Extending or overriding existing business logic

2.3       Consistent and Compelling User Interface

OA Framework offers developers a wide range of user interface components that make the building of applications into a more assembly process, freeing developers from the repetitive 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)

  • Each layer only “knows” about the layers below it.
  • This encapsulation allows reuse at any of the layer boundaries.

On User Interface Side, reusable components can be saved as Shared regions in the MDS repository and reused across several pages.

Example for Shared region is LOV (list of values).
It is independent object. We can attach the same LOV to text item in several pages.

3.         OA Framework Essentials

Key JSP Application Components
1)The Browser communicates with the middle tier using HTTP which involves sending a request message to which the middle tier replies with a response message.

2)A JSP is a file with some HTML and JAVA code that executes top to bottom. At runtime, it is compiled into a Java class which is actually a Servlet.

3)A Servlet is a Java web based application server extension program that implements a Standard API.

4)A Servlet Session is a mechanism for maintaining state between HTTP requests during a period of continuous interaction between Browser and Web Application. A Session may be initiated at any time by the application and terminated by the application, by the user closing the browser, or by a period of inactivity.
A session usually corresponds to an application login/logout cycle.

5)A JavaBean (Bean for short) is simply a reusable component that implements specific design patterns to make it easy for programmers and development tools to discover the object’s properties and behavior.

6)Any objects in the middle tier that communicate with the database use a JDBC (Java DataBase Connectivity).

Diagram to understand the above points

4.         Implement the MODEL in OAF

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.

Business logic/data handling (Model) is done using BC4J.

The below objects are BC4J Objects.

1) Entity Object

Entity Objects encapsulate business logic and DML operations for application tables.

Note: Entity objects can also be based on views, synonyms or snapshots.

There is a one-to-one mapping between a table and an entity object, and all Oracle Applications entity objects should include all columns in their associated tables.

Entity objects use a declarative mapping between their attributes and underlying database columns to automatically implement queries, inserts, updates and deletes.

Two files will be created automatically after creating Entity Object(EO).

They are    i) EmployeeEO.xml    ii)

“EmployeeEO” is name of the Entity Object (EO).

The below methods are available under .java file (
We can write business logic in EO at entity level to meet business requirements (Example: validateStartDate ())
Methods under Entity Object:-

  • create()  [Add attribute defaulting logic in this method]
  • remove()[Add entity remove logic in this method]
  • set methods [sets value as the attribute value]
    (Example: setEmployeeId, setFirstName etc)
  • get methods [gets the attribute value, using alias name]
    (Example: getEmployeeId, getFirstName etc)
  • validateEntity()

Entity Object (EO) should have following attributes:
  • CreationDate
  • CreatedBy
  • LastUpdateDate
  • LastUpdatedBy
  • LastUpdateLogin

2) View Objects
  • Encapsulates a database query
  • Provide iteration over the query result set
  • Primarily based on Eos (Entity Objects)
  • May be based on plain SQL for certain types of tasks
  • May be based on multiple entity objects if the UI is for update
  • Provide single point of contact for getting and setting entity object values
  • May be linked together by view links

    Two files will be created after creating View Object (VO)
    They are 1) .java (Row level)    2) .java (Object level)        3) .xml file
    Example: i) EmployeeNamesVO.xml

     We will write code in .java files.

    3) Association Objects
Association object is used to create relationship between Entity   objects. There are two types of associations are given below.
<![if !supportLists]>1)      <![endif]>Composition   (Strong association)
<![if !supportLists]>2)      <![endif]>Reference      (Weak association)

Composition: -   The destination entity object can not exist independent of its source entity 
Example: A purchase order header is automatically locked even if you make changes only to its lines. Child is deleted when parent is deleted.

Reference: - The source entity object simply references the destination object.

Example: A purchase order header references a supplier, but the supplier can still exist regardless of whether a purchase order references it or not.    

4) Application Modules
  • Application Module serves as container for ViewObjects and ViewLinks
  • Application Module establishes database connection.
  • Attach the Application Module to OA Framework page.

5.       Implement the VIEW in OAF

The VIEW formats and presents model data to user.

We have to define OAF page to display data.

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

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.


6.         Implement the CONTROLLER in OAF

CONTROLLER is used to enhance OA Framework page using logic for buttons, automatic queries, dynamic WHERE clauses, JSP forwards, and the Message Dictionary.

  • Controllers for regions
<![if !supportLists]>ü  <![endif]>processRequest method (code for page initialization such as HTTP GET actions and so on)
<![if !supportLists]>ü  <![endif]>processFormRequest method (code for HTTP POST actions. When press the button the code will be executed)

Typical Locations for Code
We could not call methods of Entity Objects (EO) from Controller directly. We have to follow below order to call method from location to other location.

<![if !supportLists]>1)      <![endif]>Call methods of ApplicationModule from Controller only
<![if !supportLists]>2)      <![endif]>Call methods of ViewObject from ApplicationModule only
<![if !supportLists]>3)      <![endif]>Call methods of EntityObject from ViewObject only
<![if !supportLists]>4)      <![endif]>EntityObject is based on Database table

   Note:  Please look ONION structure to understand above points.

7.         OAF Key Do's and Don'ts (Part 1) - "Top 10" Golden Rules

I don't know how many of you have come across this in the OAF Devguide, it was only by change that I found it, thought I'd share:

There's a lot to learn when getting started with the OA Framework, but the following list of rules are so universal -- and so fundamental -- they should be familiar to anyone who's doing Framework development.

1) ALWAYS try to declaratively define your UI. Resort to a programmatic layout only if the UI cannot be implemented declaratively. Programmatic layouts are difficult to customize (they don't leverage the Personalization Framework) and may diverge from the UI Guidelines over time.

2) NEVER change your UI layout properties in processFormRequest(). ALWAYS make changes in processRequest(), even if that means handling an event in processFormRequest() and then redirecting back to the same page. This ensures that the web bean hierarchy is in a stable state when the page renders.

3) NEVER use index numbers to find beans when you want to change their properties. ALWAYS search by name. Index numbers can change during processing.

4) NEVER change the properties of a parent bean from a child bean. This is a poor design practice that hampers reuse while introducing fragile code (particularly if the child code executes too late in the page rendering cycle to properly affect the parent).

5) NEVER instantiate Beans using "new OA Bean()". ALWAYS use the createWebBean() factory methods available on the OAControllerImpl class. Not all Bean properties are initialized correctly when you use "new."

6) NEVER create Form Beans in code (this means NEVER add nested Form beans to a page; your Page Layout region should be the only form region). Multiple form Beans on a page are not supported and can result in strange runtime behaviors.

7) NEVER count on your Application Module using the same database connection in subsequent requests. For example, NEVER post and commit in separate requests. For performance reasons, the Framework will start pooling and reusing connections in 5.7 instead of holding onto a single connection throughout the life of an Application Module.

8) NEVER use JDBC directly unless you're calling a PL/SQL routine (you should use a view object instead, and if possible, the view object should be defined declaratively and not programmatically).

9) NEVER add member variables UNLESS THEY ARE TRANSIENT OR FINAL to view objects, Controllers, entity object, view rows and Application Modules.

10) ALWAYS adhere to the Self-Service Performance Guidelines

8.         Create Simple OAF WELCOME Page
Step 1: Open JDeveloper tool, Create New OAworkspace.

Navigation: - right click on Workspaces option in system-navigator Window and select New OAWorkspace

Step 2: i) Enter workspace name in file name column as
               “XXXOAWorkspace.jws”, and press OK button.
           ii) Press Next button
           iii) Enter project Name in file name column as “XXXOAProject.jpr”
           iv) Enter Default package name as
                “” and press Next button twice.

We can see the package structure ( in “myprojects” folder. The package structure is used to place EO, VO, AM and Pages.

Step 3: Enter .dbc file location in DBC File Name column
            E:\p4045639_11i_GENERIC\jdevhome\jdev\myhtml\OA_HTML\Secure\ xxxxx.dbc]

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.

Enter User Name: operations5 (oracle application user name)
Enter Password  :    xxxxxxxxx      

Application Short Name: AK
Responsibility Key        : FWK_TBX_TUTORIAL

Press Finish button.

Now, creation of OAWorkspace, OAProject and front-end connections successfully completed.

Step 4: Create new OA page
            Select project name (xxxOAProject) and click right mouse button, then select New 
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.
            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.

Press OK button, then page web bean (WelcomePG.xml) will be created.         

     Now, we will run the .xml (WelcomePG.xml) to render the OAF page on the Browser.
        In above diagram, there is “region1” called root region. It is container, consists items
        and other regions.

Set the properties for root region (region1) in property inspector window.

    Property Name
       Region Style 
       Window Title
    Welcome Window
    Welcome Page
       AM Definition
Note: we are not yet creating Application Module. So, this
          application module is using which is default.

Step 6: Create subregion (style: messagecomponentlayout) under the Pagelayout region.

            Select “MainRN” and click right mouse button, select “region” Option and set the
            below properties.               
    Property Name
        Region Style   

Step 7: Create item under “SubRN
            Select the region “SubRN” and click right mouse button, and then select the option
            “messageTextInput” and set the below properties.
    Property Name
        Region Style   
     Enter Your Name
       Additional Text
     Enter any string to display it
     on the page
   (It is like Tooltip text)

See below screen shot to select “messageTextInput”.           

Save the project and compile the page (WelcomePG.xml)

Steps to compile the WelcomePG.xml

<![if !supportLists]>Ø  <![endif]>Select the .xml (WelcomePG.xml) and click right mouse button.
<![if !supportLists]>Ø  <![endif]>Select “Make WelcomePG.xml” option, and verify the errors on log messages tool box (see bottom) if occurred.

Step 8: Run the OAF Page (WelcomePG)
            Select the page (WelcomePG.xml) and click right mouse button, then select “Run
            WelcomePG.xml” option. (See above screenshot for your reference)

<![if !vml]><![endif]>See the below OAF page screenshot and verify the window title, page title and text item prompt with above properties.

<![if !vml]><![endif]><![if !vml]><![endif]>

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

<![if !supportLists]>      <![endif]>Display the message as “Welcome <text item value>” on the OAF                    page when you press the “Go” button

        Step 1: Create button item under the sub region “SubRN”.
                    Select the region “SubRN” and click right mouse button, select the option 
                   “messagelayout” (is used to place the buttons).    

    Property Name

      Step 2: Create button item under the “ButtonLayout”.

                  Select the region “ButtonLayout” and click right mouse button, and select the     
                  Option “item”.


Set the Button item properties.
    Property Name
         Item Style
        Additional Text
   Click the button

Step 3: Create Controller.
             Select the “MainRN” region and click right mouse button, and then choose the option
            “Set New Controller”.

Enter Controller Name: WelcomeCO and press the OK button.

After press the OK button, one .java file will be created with “Controller” name as
See below screenshot:-

See below screenshot once and observe the methods “processRequest” and “processFormRequest” in the Java file (

When press the “Go” button, the button related code will be executed from “processFormRequest” method (like Java POST method).

The “processRequest” code will be executed at the time of initializing the page.

Logic to display the message “Welcome <value of text item> on OAF page.  Add below code in the method “processFormRequest”.

if (pageContext.getParameter("Go")!=null)
    String str=pageContext.getParameter("WelcomeTxt");
    String message="Welcome "+str;
    throw new OAException(message,OAException.INFORMATION);

In above code, “Go” is button name (not prompt) which is used in “if” condition. “WelcomeTxt” is also text item id (not prompt).

When user press the “Go” button, the browser will send the request to middle tier and after processing the middle tier responds to browser.

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:
<![if !supportLists]>1)      <![endif]>CONFIRMATION
<![if !supportLists]>2)      <![endif]>WARNING
<![if !supportLists]>3)      <![endif]>ERROR
<![if !supportLists]>4)      <![endif]>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)

<![if !supportLists]>      <![endif]>Product Branding:

The “productBranding” is used to place image beside corporate branding image “ORACLE”.

Select “pageLayout components” and click right mouse button, and select the productBranding option.

Set the below properties for productBranding item
    Property Name
    Item1 (as you like)
         Item Style
        Additional Text
   Click the button

Set the system profile “FND: Branding Size” as “Medium” at site level.

If you change menus or profile values etc, then we have to terminate the OAF page.
Navigation: RUN->Terminate->Embedded OC4J Server (Menu bar)
Compile and run the OAF page (.xml), check the output from below screenshot.

In above screenshot, “Tutorial Application” image is productBranding image.

<![if !supportLists]>      <![endif]>In-Context Branding:

The in-context branding includes corporate branding and product branding images. Additionally, contextual information renders below corporate and product branding images.

Select “pageLayout Components” region and click right mouse button, then select the “InContextBranding” option.

Note:  productBranding can contain only “formattedText” because “In-ContextBranding” is present.

Set the properties for “productBranding” item style as “formattedText” and enter Text property as “Sales Online”.

Set the properties for inContextBranding item.

    Property Name
    Item2 (as you like)
         Item Style
Customer SUN MicroSystems-Menlo Park

We can use html tags to change font styles or display font in bold etc.

Example: Customer <b> SUN MicroSystems-Menlo Park</b>


<![if !supportLists]>      <![endif]>How do display default string in Text Item when page is rendered

OAMessageTextInputBean fieldHelloTxt=     (OAMessageTextInputBean)webBean.findChildRecursive(“WelcomeTxt”);

fieldHelloTxt.setText(pageContext, “welcome to OAF students”);

Where “WelcomeTxt” is a Text Item ID. Write above code in “processRequest” method of CONTROLLER.

Important Note:
We have to import the class “OAMessageTextInputBean”.
<![if !supportLists]>ü  <![endif]>import oracle.apps.fnd.framework.webui.beans.message.
<![if !supportLists]>ü  <![endif]>import oracle.apps.fnd.framework.webui.beans.OAWebBean; 

<![if !supportLists]>      <![endif]>How do hide Text item at runtime

The Method “setRendered” is used to hide the text item. Pass the value “false” for this method.

import oracle.apps.fnd.framework.webui.beans.message.
import oracle.apps.fnd.framework.webui.beans.OAWebBean;

OAMessageTextInputBean hellotxt= (OAMessageTextInputBean)webBean.findChildRecursive(“WelcomeTxt”);


Write above code in processRequest Method or processFormRequest of CONTROLLER according to condition.

Like setRendered method, there are so many methods are available in text item Bean.

The method “setReadonly (true)” is used to convert the item to read-only.

<![if !supportLists]>      <![endif]>How do disable the button at runtime

We have to use “OASubmitButtonBean” to change behavior of buttons at runtime.

import oracle.apps.fnd.framework.webui.beans.form.OASubmitButtonBean;

OASubmitButtonBean goButton = (OASubmitButtonBean)webBean.findChildRecursive("Go");

<![if !supportLists]>      <![endif]>How do display message in different colour

We can do it by using “rawText” style (Item property under MainRN).
In “Text” property, we can use html tags. (Display message in red color)
<b><i><font color="red"> Hello World Page</font></i></b>

Dynamically, display the rawText by using OARawTextBean

OARawTextBean rawtxt = (OARawTextBean)webBean.findChildRecursive("item3");

rawtxt.setText("Inventory Details are Transferred");

rawtxt.setText ("<b><i><font color= red> Inventory Details are Transferred</font></i></b>");

Display the message in red color. See below screenshot.

<![if !supportLists]>      <![endif]>How do call the specified page from another page

I have two pages. One page is security page, if user enters the login details correct then open the other specific page.

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)

(Write in Controller – processFormRequest Method)
if (uname.equals("Venky")&&pwd.equals("Venky"))
    {      pageContext.setForwardURL("OA.jsp?page=/train/oracle/apps/ak/welcome/webui/WelcomePG",

Enter user name and password correct, and then press “Go” button.
Note: Set text item property “secret” as True when enter password. User could not see the password while entering.
The below page “WelcomePG” will be opened.

<![if !supportLists]>      <![endif]>How do display the Return Navigation link on the page

Suppose, if user call second page from first page and perform some actions on the second page. Later, the user wants to go back to first page, then we have to use “Return Navigation” link.

Select the region “pageLayoutRN” and click right mouse button, and then select the option “returnNavigation”.

Set the properties for “returnNavigation” item.
    Property Name
         Item Style
      Destination URI
Return to Security Page

Output for returnNavigation link (Return to Security Page):-

See the below screenshot.
When user presses the “Return to Security Page” link, then the security page will be opened.

<![if !supportLists]>      <![endif]>How do add a returnLink dynamically

processRequest(OAPageContext pageContext, OAWebBean webBean)
super.processRequest(pageContext, webBean);
OALinkBean returnLink =
(OALinkBean)createWebBean(pageContext, OAWebBeanConstants.LINK_BEAN, null,"returnLink");
// Retrieve and set the translated link text.
String linkText = pageContext.getMessage("AK","FWK_TBX_T_RETURN_TO_POS", null);

// Add the return link to the page.


Following problems are related to work on Database data

<![if !supportLists]>      <![endif]>Connect to Database and return number of suppliers on the page

import oracle.apps.fnd.framework.webui.OAWebBeanConstants;
import oracle.apps.fnd.framework.server.OADBTransaction;
import java.sql.*;

Write below code in process request() method or anywhere as per requirement.
oracle.apps.fnd.framework.OAApplicationModule am = pageContext.getApplicationModule(webBean);

String task2Info = null;
 PreparedStatement psProType = null;
ResultSet rsProType = null;
int task2Type = 0;
Connection conn = am.getOADBTransaction().getJdbcConnection();


          psProType = conn.prepareStatement(task2Info);
          rsProType = psProType.executeQuery();
          if (
            task2Type = rsProType.getInt(1);
          } catch(Exception e) {pageContext.writeDiagnostics(am,e.getMessage(),4);}

throw new OAException(“supplier count :+task2Type, OAException.INFORMATION);

See below screen shot for output.

<![if !supportLists]>      <![endif]>How do call stored procedure from OAF page (Without using EO, VO)

Place the button “Callable” and write above code in processFormRequest method

import java.sql.Connection;
import oracle.jdbc.OracleCallableStatement;

if (pageContext.getParameter("Callable")!=null)
      String deleteStmt = "BEGIN DELETE_RECORD( " +
                                     "PARAM1 => :1); END; ";
      OADBTransaction trxn = am.getOADBTransaction();  
       CallableStatement delproc =   
                     trxn. createCallableStatement(deleteStmt,1) ;
      // Rebind parameters
    } catch(Exception sqle)
       pageContext.writeDiagnostics(am, sqle.getMessage(), 4);
      //CallableStatement deleteSt=conn.prepareCall(deleteStmt);

  • First, create stored procedure “DELETE_RECORD”.

  DELETE FROM emp WHERE ename=param1;
END delete_record


Solution: we can display message by using “putDialogMessage” Method.
import oracle.apps.fnd.framework.webui.OADialogPage;
import oracle.apps.fnd.common.MessageToken;

MessageToken[] tokens = {new MessageToken("EMP_NAME", “rahul”)};
  // rahul is employee name
      OAException message = new OAException("AK",
        "FWK_TBX_T_EMP_DELETE_CONFIRM", tokens, OAException.CONFIRMATION, null);
      pageContext.putDialogMessage(message);    --display message.
See below screenshot

« FWK_TBX_T_EMP_DELETE_CONFIRM » is message name in AOL.

<![if !supportLists]>      <![endif]>How do call D2K Form from OAF page



Write above code in controller for button. Opens the PO Form when click the button.

<![if !supportLists]>      <![endif]>Implement a Search Page

<![if !supportLists]>1)      <![endif]>Create project
<![if !supportLists]>2)      <![endif]>Create Business Component Package “”
<![if !supportLists]>3)      <![endif]>Create Entity object (EO) under the above package.
<![if !supportLists]>4)      <![endif]>Create Application Module (AM) under the package “”
Application Module Name: EmployeeAM
<![if !supportLists]>5)      <![endif]>Create an Employee-to-Manager Association (AO) for the self- join condition on the “FWK_TBX_EMPLOYEE” table.

<![if !supportLists]>6)      <![endif]>Select “Manager Id” in source table and Select “EmployeeId” in Destination table.
<![if !supportLists]>7)      <![endif]>Click “Add” button

Click “Next” button and verify “Expose Accessor” names.

Create ViewObject (VO) to display the data on the page. Here, VO is based on EO.

Select “EmpSearchEO” object twice. There are two entity objects and linked the two Eos through Association Object (AO).
10) Select Next button, and select attributes from EmpSearchEO and EmpSearchEO1.
Select below columns from EmpSearchEO and EmpSearchEO1.
<![if !supportLists]>o   <![endif]>EmployeeId
<![if !supportLists]>o   <![endif]>FullName
<![if !supportLists]>o   <![endif]>EmailAddress
12)  Changes attribute name and alias as meaningful. 

Select Attribute
Attribute Name and Alias Name
ManagerId and MANAGER_ID
EmployeeName and EMPLOYEE_NAME
ManagerName and MANAGER_NAME
EmployeeEmail and EMPLOYEE_EMAIL
ManagerEmail  and  MANAGER_EMAIL

Select Next button, and observer Query. We can change query, if you select the check box “Expert Mode”.

13) Now, I want to include some other condition in the above query.


       Flkp.meaning POSITION_DISPLAY
         FWK_TBX_EMPLOYEES EmpSearchEO1,
AND EmpSearchEO.POSITION_CODE=flkp.lookup_code
AND flkp.lookup_type=’FWK_TBX_POSITIONS’

Select Next button, and check mapping between Query Columns and Attribute names. Select Finish button.

14) Add the ViewObject (EmployeeSummaryVO) to Application Module.

15) Select the application module (already created), and press right  mouse button and select the option “Edit EmpSearchAM”, then select the “ViewObject”.

16) Attach the Application Module (EmpSearchAM) to your OApage. 
17) Create the item under “PageLayout Region”. The item style is “StaticStyledText”.
       Set the below properties for the item.
  Item Style
  CSS Class
  Message Appl Short Name
  Message Name
Test the page once and check the output on the page. Some text will be displayed on the page above.

Configure RESULT-BASED Search.
18) Create region with style “query” under pageLayout Region.
 Set the below properties for the region “queryRN”.
  Item Style
  Construction Mode
  Result Based Search
  Include simple panel
  Include View panel
  Include Advanced search panel

19) Adds a Results Data table to queryRN.
      Select the queryRn and press right mouse button, then select option “Region using
20) Select the viewobject “EmployeeSummaryVO” and select specified columns what you 
       want to display on the OAPage.    
21) Set below properties for “ResultsTable”.
22) Set the properties for columns under “ResultsTable”.

<![if !supportLists]>      <![endif]>How do display the drill down to details page according to criteria.


<![if !supportLists]>1)    <![endif]>Create view object with SQL query.

The query is:

            EmployeeName AS EMPLOYEE_NAME,
            Job AS JOB,
            Salary AS SALARY,
            Deptno AS DEPARTMENT_NUM
<![if !supportLists]>2)    <![endif]>Select the items style as “MessageStyledText”.
<![if !supportLists]>3)    <![endif]>Design the page with regions “pageLayout (root region)” and “defaultSingleColumn (Sub region)”.
<![if !supportLists]>4)    <![endif]>We can use “region using wizard” option under the region style “defaultSingleColumn” and then select displayed items by using the wizard.
<![if !supportLists]>5)    <![endif]>The page name is “EmployeeDetailsPG.xml”.
<![if !supportLists]>6)    <![endif]>Now, we have to call the “EmployeeDetailsPG” page and pass parameters to this page from the other page (search page).
<![if !supportLists]>7)    <![endif]>Set the property “Destination URI” as “OA.jsp?page=\train\oracle\apps\ak\employee\webui\EmployeeDetailsPG&employeeNumber={@EmployeeId}&retainAM=Y&ADD_BREAD_CRUMB=Y for the item “EmployeeName”. The item “EmployeeName” style is “MessageStyledText”. Now, the employeeName item will be showing as “Link
<![if !supportLists]>8)    <![endif]>Now, we have to execute the query according to employeeId (depending on selection of employeeName).
<![if !supportLists]>9)    <![endif]> In ( file, create method as below.

import oracle.jbo.domain.Number;
import oracle.apps.fnd.framework.OAException;
   public void initQuery(String employeeNumber)
   If (employeeNumber! =null)
      Number empNum=null;
   empNum=new Number(employeeNumber);
Catch(Exception e)
   Throw new OAException(“AK”,” FWK_TBX_INVALID_EMP_NUMBER”);


<![if !supportLists]>10)  <![endif]>From applicationModule, we can call view object procedure.

    public void initDetails(String employeeNumber)
   EmployeeFullVOImpl empvo=getEmployeeFullVO1();
<![if !supportLists]>11)  <![endif]>Create the CONTROLLER and call the procedure “initDetails”.
<![if !supportLists]>12)  <![endif]>Write code in “processRequest” method

       String empnum=pageContext.getParameter(“employeeNumber”);
      OAApplicationModule am=pageContext.getApplicationModule(webBean);
      Serializable[] parameters={empnum};
      Am.invokeMethod(“initDetails”, parameters);

Result:  we can get the details of employee according to employee ID.

<![if !supportLists]>      <![endif]>How do display custom copy right on OAF page


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.

<![if !supportLists]>      <![endif]> How do get the value of the checkbox when selected or deselected


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.


Write code in processFormRequest method for any button

   String val= pageContext.getParameter("chkbox");
   If (val.equals(”on” ))
If (val==null)
In this site, code has been given regarding get value of selected checkbox from VO (Displayed multiple rows)

<![if !supportLists]>      <![endif]>How do insert data from OAF Page to Database table by using View Object

<![if !supportLists]>1)      <![endif]>Create view object with query.
<![if !supportLists]>2)      <![endif]>Create application module and attach the view object
<![if !supportLists]>3)      <![endif]>Create OAF page and attach application module.
<![if !supportLists]>4)      <![endif]>Create Controller and write below code.

import 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.*;

Method: processRequest ()

public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    OAApplicationModule am=pageContext.getApplicationModule(webBean);

Method: processFormRequest ()
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);

    if (pageContext.getParameter("Apply")!=null)
       OAApplicationModule am=pageContext.getApplicationModule(webBean);
      //    Date update_date=pageContext.getCurrentUserDate();
      //   System.out.println("current date="+update_date);
      OAMessageTextInputBean supplier_id    =
      String sup_id_txt=supplier_id.getText(pageContext);
      int sup_id=Integer.parseInt(sup_id_txt);
      OAMessageLovInputBean sup_name =
      String supname_txt=sup_name.getText(pageContext);
      OAMessageTextInputBean onhold_flag =
      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;
      int task2Type = 0;
      Connection conn = am.getOADBTransaction().getJdbcConnection();

        psProType = conn.prepareStatement(task2Info);
       // psProType.setString();
   catch(Exception e)
       // psProType.setDate(5,edate);

Write below methods in Application Module which is corresponding to view object.

// it is used to create row in view object cache, and then user can enter and insert data into table.

public void initQuery()
    SuppliersVOImpl vo=getSuppliersVO1();
    Row row=vo.createRow();
// it is for commit the transaction; otherwise not inserted the record into table.
  public void apply()

Please find the below screen shot. The below data will be inserted into table when press the “Apply” button.

See below screenshot for output.


<![if !supportLists]>      <![endif]>How do refresh the same page after the data has been entered

There is API “forwardImmediatelyToCurrentPage” used to refresh the same page when the user presses the submit button.

Write below code in processFormRequest() method

HashMap params = new HashMap();


<![if !supportLists]>      <![endif]>How do set the values in poplist

<![if !supportLists]>1)      <![endif]>Create View Object(VO) and write query to display the values in poplist. 
          VO Name: SuppliersListVO


‘YES’ is used to show for user on the OAF page. ‘Y’ is used for internal purpose. The value ‘Y’ will be stored into database when user selects ‘YES’.

Set the properties for an item:-

     Item Style
     Picklist view Definition
     Picklist Display  Attribute
     Picklist Value Attribute

<![if !supportLists]>      <![endif]>How do hide the specified item when user selects the particular value from Poplist


The concepts “partial page rendering” and “SPEL” should be used to get this solution.

I have one poplist in OAF page and the list has two values “YES” and “NO”. If the user selects the value “NO”, then the specified item should be invisible on OAF page at runtime.

Note: This example followed above screen shot page.

1) Create properties view object (PVO) and create two attributes.
     i) RowKey  (Set the properties like below screenshot)

ii) EndDateRender (Set the properties as per below screenshot)

<![if !supportLists]>2)      <![endif]>Select the option “Tuning” for the same properties VO and select the check box like below screenshot.

<![if !supportLists]>3)      <![endif]>Attach the propertiesVO (SuppliersListPVO) to application module (SuppliersAM).
<![if !supportLists]>4)      <![endif]>Configure the list item (onholdflag item). Set the below properties.

   Disable Server Side Validation
   Disable Client Side Validation

<![if !supportLists]>5)      <![endif]>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”.


<![if !supportLists]>6)      <![endif]>Write below methods in application module (
public void onholdflagChange()
    OAViewObject vo = (OAViewObject)findViewObject("SuppliersListPVO1");
    OARow row=(OARow)vo.first();
    OAViewObject suppvo=(OAViewObject)findViewObject("SuppliersVO1");
    OARow supprow=(OARow)suppvo.getCurrentRow();
    String onhold=(String)supprow.getAttribute("OnHoldFlag");
    if ((onhold==null)||("N".equals(onhold)))


public void init()
    OAViewObject appPropsVO=(OAViewObject)findViewObject("SuppliersListPVO1");
    if (appPropsVO!=null)
      if (appPropsVO.getFetchedRowCount()==0)
        OARow row=(OARow)appPropsVO.first();
        row.setAttribute("RowKey",new Number(1));

<![if !supportLists]>7)      <![endif]>Call the init() method from processRequest.

<![if !supportLists]>8)      <![endif]>call the onholdflagChange() method from processFormRequest

    if ("onholdflagChange".equals(pageContext.getParameter(OAWebBeanConstants.EVENT_PARAM)))

In the above code, the “onholdflagChange” is event name. The event of the item will be worked as form-submit. So, the above code (event related) has been written in processFormRequest.

Run the OAF page and change the value of the list item. The item “EndDate” will not be rendered if the value of the list item is “NO”.

<![if !supportLists]>      <![endif]>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

<![if !supportLists]>1)      <![endif]>Set the below properties for item “SupplierId”.

<![if !supportLists]>2)      <![endif]>Write below code in processFormRequest method.

  int supp_id = Integer.parseInt(pageContext.getParameter("SupplierId"));
  if (supp_id==195)

<![if !supportLists]>3)      <![endif]>Write below method “supplierNameEvent” in an application module.

   public void supplierNameEvent()
    OAViewObject    suppvo = 
    OARow supprow=(OARow)suppvo.getCurrentRow();
Note:  The webBean properties can not be modified in processFormRequest method   
             (Ex: setText; setName etc).
Result: Enter the value “195” in supplier id text item and press tab key, then the name
             Ramprasad” will be getting displayed in supplier name text item.

<![if !supportLists]>      <![endif]>How do create list box and add values to the list box dynamically


First, create a messageLayout region under messageComponentLayout region because we are creating Listbox item under “messageLayout” region using the below code.

Write below code in processRequest() method of CONTROLLER.

import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.framework.webui.OAControllerImpl;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.apps.fnd.framework.webui.beans.form.OADefaultListBean;
import oracle.apps.fnd.framework.webui.OAWebBeanConstants;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageLayoutBean;

public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    //Create List WebBean
    OADefaultListBean list = (OADefaultListBean)createWebBean(pageContext,OAWebBeanConstants.DEFAULT_LIST_BEAN, null, "positionsList");
   // Set the Viewobject name, display attribute and value attribute for list box.

   OAMessageLayoutBean listBoxLayout =


<![if !supportLists]>      <![endif]>Create a Shuttle Region

Following 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 *):
*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.

Ordering Allowed - set to True if you want to enable ordering of the contents of the Selected (second or trailing) list.
If you implement only one (leading) list in the shuttle region to create a Reordering region, then setting this property to True enables ordering on that leading list. The default is False.

Step 3: The Shuttle region can have a maximum of two list web beans, referred to as the leading and trailing lists. The trailing list is omitted when you want to implement a shuttle region with a single list for the purpose of reordering the contents of that list.
When you define a shuttle region, OA Extension automatically creates a leading component for you, which contains a single list item.
Be sure to set the following properties on the list item (Required properties are marked with *):

*ID - set the list's ID property in accordance with the OA Framework File / Package/ Directory Standards.

*Multi-Select Allowed - set to True to allow the multiple selection of items in the list. The default is False.

Picklist View Definition - specify the fully qualified view object name that is the data source to the List web bean.
(For example, oracle.apps.fnd.framework.server.FndApplicationVO)

*Picklist View Instance - alternately specify a view instance name for the data source of the list, if the Picklist View Definition is not available. Note that setting this property overrides the Picklist View Definition property.
(For example, FndApplicationVO, which needs to be present in the ApplicationModule.)

*Picklist Display Attribute - specify the view attribute name that serves as the displayed values of the list's content.

*Picklist Value Attribute - specify the view attribute name that serves as the internal values of the list's content. This property, and not the Picklist Display Attribute property, uniquely identifies the elements in the list.

Picklist Description Attribute - specify the view attribute name that serves as the descriptions of the list's content.

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.

Note: The List Height is only a suggested value. Your browser application and UIX determines the final 446 height of the list based on the number of items in the list and the size of the browser window.

Step 4: To create an optional trailing list, select the shuttle region in the Structure pane and choose New >trailing from the context menu. OA Extension automatically creates a trailing component for you, which contains a single list item.
Refer to Step 3 for the list of properties that you should also set on the trailing list item. Make sure you specify names for the Picklist Display Attribute, Picklist Value Attribute and Picklist Description Attribute properties that match the corresponding property of the leading list item.

Note: If you do not want to pre-populate the trailing list when the page initially renders, you can leave the Picklist View Definition, Picklist View Instance, Picklist Display Attribute, Picklist Value Attribute and PicklistDescription Attribute blank. OA Framework takes care of retaining user selected values in the trailing list when the page refreshes.

Note: The Picklist Value Attribute uniquely identifies the elements in a list, so if you want to pre-populate both the leading list and trailing list with data, be sure to set the Picklist Value Attribute property to a different value for each list. Setting this property to the same value for both lists will result in undesirable behaviour, such as causing the values in the leading list to disappear.

Step 5: You can include buttons or icons in the footer of each list, as shown in Figure 2. Select the shuttle region in the Structure pane, and choose New > leadingFooter (for a footer in the leading list) or New > trailingFooter (for a footer in the trailing list). OA Extension automatically creates a leadingFooter or trailingFooter component, respectively, each containing a flowLayout region. You can then add your buttons or icons to this flowlayout region.

Note: If you set the Rendered property to False for either the leading or trailing list, the leading or trailing footer also does not render, respectively. Since the footer is directly linked to its respective list, if the list is not rendered, the footer is irrelevant.

<![if !supportLists]>      <![endif]>About StackLayout, rowLayout, cellFormat region styles

We can design layout like below screen shot by using the stackLayout, rowLayout and cellFormat region styles.

      |-----stackLayout region
                  |----rowLayout region
                            |---------cellFormat region
                                             |-------spacer (item style)
                                             |         (width: 400)
                                             |-------item (style: formattedText)
                                        (Text: <b>Authority For Expenditure</b>
                               (Please look above screenshot for result)

    |------stackLayout region
                |----rowLayout region
                        |----cellFormat region
                                 |-----spacer (item style)
                                 |       (width: 400)
                                 |-----item (style: formattedText)
                      (Property Text: <b>Co:  101   XXX Energy Inc</b>)

   |--------stackLayout region
                  |-----rowLayout region
                           |-----cellFormat region
                                    |------ table region
                                          |----- item1 (style: messageStyledText)  
                           |-----cellFormat region
                                    |------ table region
                                          |----- item2 (style: messageStyledText)  

                           |-----cellFormat region
                                    |------ table region
                                          |----- item3 (style: messageStyledText) 

Set the properties for item1, item2 and item3. The properties are

<![if !supportLists]>§  <![endif]>Prompt
<![if !supportLists]>§  <![endif]>View Instance
<![if !supportLists]>§  <![endif]>View Attribute
(Please see table region in above screenshot for result)

How to display text items side by side


      |-----stackLayout region
                  |----rowLayout region
                            |---------cellFormat region
                                             |-------item (messageTextInput)
                            |---------cellFormat region        
                                             |-------item (style: spacer; width: 50)

Set the item properties for messageTextinput.
The properties are   prompt, view Instance and view Attribute  

(Please see above screenshot for result).

<![if !supportLists]>      <![endif]>About Browser Look and Feel (BLAF)

A Look-and-Feel (LAF) controls the appearance of an OA Framework application. An LAF provides the rendering logic for each component along with a look and feel-specific style sheet.

The OA Framework supports three LAFs.

<![if !supportLists]>ü  <![endif]>Oracle BLAF -- implements the Oracle Browser Look-and-Feel (BLAF) UI Guidelines.

<![if !supportLists]>ü  <![endif]>Minimum LAF (MLAF) -- generates "minimal" content to reduce the size of HTML pages and overall network overhead (for example, this LAF uses fewer images than the BLAF version)

<![if !supportLists]>ü  <![endif]>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.


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.

<![if !supportLists]>      <![endif]>About AdvancedTable Bean

Previously, OA Framework used oracle.apps.fnd.framework.webui.beans.table.OATableBean, an Oracle Application implementation of UIX oracle.cabo.ui.beans.table.TableBean, to render tables. Now oracle.apps.fnd.framework.webui.beans.table.OAAdvancedTableBean extends OATableBean to provide declarative support for existing table features that previously required programmatic control. OAAdvancedTableBean also provides declarative support for features not available with OATableBean, such as column span in a table column header. As of Release 11.5.10, oracle corp. recommend new tables be implemented as "advanced tables" based on oracle.apps.fnd.framework.webui.beans.table.OAAdvancedTableBean.
You can create a table by specifying appropriate information in Oracle 9i JDeveloper OA Extension. Currently, you can declaratively specify the following features/components/attributes on a table:
  • Number of rows to display in a table
  • Width of a table
  • Header text for individual table columns
  • Column span in column headers
  • Table formatting
  • Single selection and multiple selection on a table and adding other controls to a selection bar
  • Sorting and initial sorting of a table on up to three columns
  • Totalling a column
  • Adding new rows
  • Detail Disclosure
  • Row Headers
  • Wrap Settings
     Below is a brief outline of how to declaratively implement a table.
AdvanceTablePG (.xml)
       |---create region (style: advancedTable;
                                   Set View Instance property)
             |---create column
                    |---create item (style: messageTextInput; 
                                            Set the View Attribute property)
                    |---create column header (to display heading of the
                                                            Column and sort the data)
<![if !supportLists]>ü  <![endif]>Set the prompt property in column header properties to display heading of the column (example: Employee Name)
<![if !supportLists]>ü  <![endif]>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.

We need to write code to display data like below screenshot.

Create controller (EmpAdvancedCO) on PageLayout Region.      

public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    oracle.apps.fnd.framework.OAApplicationModule   am =  
//create row and execute query
Go to the corresponding Application Module and write below code to create row and execute query.
(i.e. pagelayout region AM Definition property value)

import oracle.jbo.Row;

public void initQueryAdv()
    EmployeeFullVoImpl empvo=getEmployeeFullVo1();
    Row row=empvo.createRow();

In above code, the “EmployeeFullVo1” is view object instance.

Compile the code and run the page.

<![if !supportLists]>      <![endif]>How do display “Add another row” button and totalling on column

In AdvancedTable, this is good feature to add row dynamically and display total on footer without write code.

Declarative implementation
Select the “advancedTable” region and press right mouse button and select the option “footer”.   

After select the “footer” option, the footer and tableFooter1 components will be created. See below screenshot.

Select the “tableFooter1” and press right mouse button and select the option “addTableRow”. See below screenshot.

Run the page once and you will get “Add another Row” button at the footer of advancedTable.

Select “total” option to display total of particular column (salary). The option “total” showing in above screen shot.

We need to set one property “Total Value” as True for salary column (column4 in below screen shot) and run the page.

See the below screenshot to know the final output of advancedTable. (Add Another Row button, Recalculate button and total value for salary column)

After press the “Add Another Row” button, one blank record will be created. See below screen shot.

User selects the Recalculate button to update the column total.

Note: The total displays a double precision summation of all visible rows in the table. 
          The total reflects only the current visible records and not all the records queried.

<![if !supportLists]>      <![endif]>How do iterate the number(Serial Number) in OAF by using Transient Attribute

public void setItemDetailsSno()
   OAViewObject vo = (OAViewObject)getCMCostchangeVO();
   CMCostchangeVORowImpl row = null;
   int fetchedRowCount = vo.getRowCount();
    // we use a separate iterator -- even though we could step through the
    // rows without it -- because we don't want to affect row currency.
    RowSetIterator insertIter = vo.createRowSetIterator("insertIter1");
    if (fetchedRowCount > 0)
      for (int i = 0; i < fetchedRowCount; i++)
        row = (CMCostchangeVORowImpl)insertIter.getRowAtRangeIndex(i);
        // For performance reasons, we generate ViewRowImpls for all
        // View Objects.  When we need to obtain an attribute value,
        // we use the named accessors instead of a generic String lookup.
       row.setAttribute("SNo", new Integer(i+1));
                                                //SNo is transient attribute in VO

See below screenshot and check the values of serial number
     Check the values of serial number in above screen shot.


<![if !supportLists]>      <![endif]>How do display latest serial number dynamically while creating row

Write below code in proecessFormRequest Method of Controller.

oracle.apps.fnd.framework.OAApplicationModule am=pageContext.getApplicationModule(webBean);
    OAAdvancedTableBean tableBean  =
if (tableBean.getName().equals(pageContext.getParameter(SOURCE_PARAM))
          && ADD_ROWS_EVENT.equals(pageContext.getParameter(EVENT_PARAM)))

Note:  From above code, ADD_ROWS_EVENT is event name for “Add Another Row” button.

Write below code in Application Module which is added to your pagelayout region.

Imp: Set the property “insert rows automatically” as False in addTableRow1 object at footer of advanced table.

public void setSequenceNum()
   SequenceNumberVOImpl seqvo=getSequenceNumberVO1();
   int fetchedRowCount=seqvo.getRowCount();
   RowSet rowset=seqvo.createRowSet("dd");
   Row row=seqvo.createRow();
   row.setAttribute("SERIALNUM",new Integer(fetchedRowCount+1));

Result: Display Serial Number (transient attribute) according to current row position dynamically after pressing the “Add Another Row” button.

See below screen shot, after press the “Add Another Row” button

New row is created and added onto table, and SerialNumber is also incremented (from 6 to 7) and displayed on table.  See below screenshot.

<![if !supportLists]>      <![endif]>How do delete a selected record of Advanced Table using Delete Switcher

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)

            '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 ”
<![if !supportLists]>5)      <![endif]>Create second image item under second case.
      Set the imageID as “DeleteEnabled” (same as in VO)
       Set the imageURI property as “deleteicon_enabled.gif ”
<![if !supportLists]>6)      <![endif]>Set the image items height and width as “24”
<![if !supportLists]>7)      <![endif]>Set the action property for “DeleteEnabled” image as “fireAction” and Event as “delete”. Set the parameters property under Event property as below screenshot.

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)
      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)
          //getTransaction().commit(); (if remove this comments,
                                                       then the record will be
                                                         removed from database)

Invoke above method from CONTROLLER. Write below code in processFormRequest method of CONTROLLER.

public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processFormRequest(pageContext, webBean);
oracle.apps.fnd.framework.OAApplicationModule am =
     if ("delete".equals(pageContext.getParameter(EVENT_PARAM)))
    {String supplierNumber = pageContext.getParameter("supplierNUM");
      Serializable[] parameters = { supplierNumber };
         am.invokeMethod("deleteSupplier", parameters);
       MessageToken[] tokens = {new MessageToken("EMP_NAME", supplierNumber)};
       OAException message = new OAException("AK",
                "FWK_TBX_T_EMP_DELETE_CONFIRM", tokens, 
                                                           OAException.CONFIRMATION, null);

From the CONTROLLER code, the “delete” is event name in “DeleteEnabled” image. The “supplierNUM” is value of SPEL “${oa.SequenceNumberVO1.SERIALNUM}

Run the page and get below output.

Press the Delete switcher of any record and then check the output. Now, the record still available in database because of not committed this transaction. After press the “Save” button, the record will be removed from the database.

If user wanted to show checkbox for onHoldFlag column, then we need to change the item style of the “onHoldFlag” item as “messageCheckBox”. Set the below check box properties
checkedValue:     Y    ;  uncheckedValue:    N

        Check the onHoldFlag values in above screenshots.

<![if !supportLists]>      <![endif]>How do clear the View Object at runtime


     Write below code in Application Module.

Public void clearVO()
SupplierInfoVOImpl vo= getSupplierInfoVO1();
vo.remove() ;}

Call above method from CONTROLLER (processFormRequest).
OAApplicationModule am =pageContext.getApplicationModule(webBean);

Please see below screenshots
After press the clear button, the data will be cleared. See below screenshot.

<![if !supportLists]>(a)      <![endif]>How to add ViewAttribute in ViewObject (VO) dynamically

We were having a requirement to add a column in an existing table region and client wants to show value in it based upon some calculation with other view attribute value.

At the first sight we thought of extending the ViewObject and adding a transient attribute.But that seems to be very complex process as this ViewObject is based on 5 EntityObjects.

So we thought of some workaround and come to a solution by adding a ViewAttribute in ViewObect dynamically.Here is the approach …

We have extended the Controller and add a ViewAttribute dynamically in the ViewObject and created a MessageStyledText bean through personalization.

public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    super.processRequest(pageContext, webBean);
    OAApplicationModule am =   (OAApplicationModule)pageContext.getApplicationModule(webBean);
OAViewObject vo = (OAViewObject)am.findViewObject("AllocationsVO1");
   if (vo != null)
   vo.addDynamicAttribute("XXSalary"); //Adding ViewAttribute to VO

     //Starting do-while for setting value in all the table row...
      //Doing some calculation... 
      int xxnumber =  Integer.parseInt(vo.getCurrentRow().getAttribute("Empno").toString());     
      double= xxnumber*(17.5/100)/2;
      String aString = Double.toString(d);
      //Setting the calculated derived value in the newly created VO Attribute
      vo.getCurrentRow().setAttribute("XXSalary", aString);;
      while (vo.hasNext());

//Finally adding ViewAttribute and ViewInstance with MessageTextInput bean which we have created through personalization
  OAMessageTextInputBean mst = (OAMessageTextInputBean)webBean.findChildRecursive("Salary");


No comments:

Post a Comment

Best Blogger TipsGet Flower Effect