Advanced Table Functionalities in OAF!


1] Add A Row:

To add an ‘Add a Row’ button, in the advanced table, go to

Advanced Table > Advanced Table Components > Footer > Table Footer > New > Add A Row.

In the Structure pane, select the addTableRow item that is newly created, as shown in the figure above, and use the Property Inspector to set its following properties (* Required):

ID* – specify an identifier that uniquely identifies the addTableRow item in the page.

Add Rows Label – specify text to override the “Add Another Row” default text that appears in the Add Another Row button.

Rows to Add – specify the number of rows to add each time a user chooses the Add Another Row button. The value for this property must not be greater than the value set for the Records Displayed property on the advanced table. The default is 1. Note that this property is valid only if the Insert Rows Automatically property is set to True.

Insert Rows Automatically – specify True to indicate rows are to be added automatically when the Add Another Row button is chosen. Specify False if you want to respond to the event in your controller, so that you can, for example, set the primary keys or set some default row attributes. Note: The Insert Rows Automatically property is equivalent to the ‘autoInsertion’ property that was set in your controller using the setAutoInsertion API for classic tables.

Add a Row in OAF Advanced Table

If you want to handle the Add a Row Event in the Controller, First set Insert Rows Automatically to False and then in controller, processFormRequest method, call your AM method when user click on the ‘Add a Row’ in your advanced table – ‘AdvTblRN’.

if  ("addRows".equals(pageContext.getParameter("event")) &&
"AdvTblRN".equals(pageContext.getParameter("source")) )
{
  System.out.println("The source is :"+pageContext.getParameter("source"));
  String p_header_id = (String)pageContext.getTransactionValue("p_tx_header_id");
  Serializable[] param = {p_header_id};
  am.invokeMethod("createRow", param);
}

In AMImpl wrote the method:

public void createRow( String p_header_id)
{
  OAViewObject pervo = getPriceLinesVO1();    // Advanced Table VO
  if(!pervo.isPreparedForExecution()){
    pervo.executeQuery();
  }
  pervo.setMaxFetchSize(0);
  pervo.last();   // Go to the last Row of the VO
  String line_number =  pervo.getCurrentRow().getAttribute("LineNumber").toString();
  String description =  pervo.getCurrentRow().getAttribute("Description").toString();
  Number line_num = new Number(Integer.parseInt(line_number) + 1);
  pervo.next();
  Row row = pervo.createRow(); // Create a New Row
  // Insert the values in the row.
  Number header_id = new Number(Integer.parseInt(p_header_id));
  row.setAttribute("HeaderId",header_id);
  row.setAttribute("LineId",getOADBTransaction().getSequenceValue("XX_PRICE_LINES_SEQ"));
  row.setAttribute("Description",description);
  row.setAttribute("LineNumber",line_num);
  pervo.insertRow(row);  // Insert the row in DB
  row.setNewRowState(Row.STATUS_NEW);
  getOADBTransaction().commit();
  System.out.println("Commit Done");
}

2] Delete Multiple Rows:

Create a Transient Attribute of type String with any name (say SelectFlag) in the VO. Choose updatable always check button.

To add a Delete button, in the advanced table, go to

Advanced Table > Advanced Table Components > TableSelection > MultipleSelection > New > SubmitButton.

In the MultipleSelection, add the view attribute defined above.

Multiple delete in OAF Advanced Table

In the controller, add logic as below:

if (pageContext.getParameter("DelBtn") != null)
{
  System.out.println("In Delete Button");
  System.out.println("The source is:"+pageContext.getParameter("source"));
  OAViewObject linesVO=(OAViewObject)am.findViewObject("PriceLinesVO1");
  Row[] row=linesVO.getFilteredRows("SelectFlag","Y");
  System.out.println("Total Rows: "+linesVO.getRowCount());
  System.out.println("Selected Rows: "+row.length);
  Row row[] = linesVO.getAllRowsInRange();
  for (int i=0;i<row.length;i++)
     {
       PriceLinesVORowImpl rowi = (PriceLinesVORowImpl) row[i];
       if (rowi.getSelectFlag()!= null && rowi.getSelectFlag().equals("Y"))
       {
         rowi.remove();
       }
     }
  am.getOADBTransaction().commit();
}

3] Update Multiple Rows:

Create a Transient Attribute of type String with any name (say SelectFlag) in the VO. Choose updatable always check button.

To add a Update button, in the advanced table, go to

Advanced Table > Advanced Table Components > TableSelection > MultipleSelection > New > SubmitButton.

In the MultipleSelection, add the view attribute defined above.

In the controller, add logic as below:

if (pageContext.getParameter("UpdateBtn") != null)
{
  System.out.println("In Update Button");
  Number user_id = new Number(am.getOADBTransaction().getUserId());
  String updated_by = user_id.toString();
  OAViewObject linesVO=(OAViewObject)am.findViewObject("PriceLinesVO1");
  Row row[] = linesVO.getAllRowsInRange();
  for (int i=0;i<row.length;i++)
    {
      PriceLinesVORowImpl rowi = (PriceLinesVORowImpl) row[i];
      if (rowi.getSelectFlag()!= null && rowi.getSelectFlag().equals("Y"))
        {
          String Bucket_low = rowi.getAttribute("BucketLow").toString();
          String Bucket_high = rowi.getAttribute("BucketHigh").toString();
          Number Price = (Number) rowi.getAttribute("Price");
          Serializable[] param = {rowi.getAttribute("LineId").toString(),rowi.getAttribute("BucketLow").toString(),rowi.getAttribute("BucketHigh").toString(),rowi.getAttribute("Price").toString(),updated_by};
          am.invokeMethod("UpdateLinesRecord",param);
        }
     }
  OAViewObject volns = (OAViewObject)am.findViewObject("PriceLinesVO1");
  volns.clearCache();
  volns.reset();
  volns.executeQuery();
}

In AM method, you can call PLSQL Procedure to update the data.

public void UpdateLinesRecord(String LineId, String BucketLow, String BucketHigh, String Price, String updated_by)
{
try {
     CallableStatement cs=this.getOADBTransaction().
     getJdbcConnection().prepareCall("{call APPS.XXTEST_LINES_PKG.UPDATE_LINES(?,?,?,?,?)}");
     cs.setString(1,LineId);
     cs.setString(2,BucketLow);
     cs.setString(3,BucketHigh);
     cs.setString(4,Price);
     cs.setString(5,updated_by);
     cs.execute();
     cs.close();
    }
catch(SQLException e) {
System.out.println("the exception is"+e);
    }
}

4] Delete or Update Single Row at one time.

If you want to add update and delete icons per rows do the followings:

  1. Create Columns in the advanced table say ‘Delete’ and ‘Update’.
  2. In the Delete Column, add an image item (deleteicon_enabled.gif). For all image names go to $OA_MEDIA folder.
  3. Set Action type to fire action.
  4. Give any name to Event (Say – ‘deleteLine’)
  5. In the parameter, pass the identifier of the row which user wants to delete. You can use SPEL for that.

Example>> p_header_id: ${oa.QotDtlVO1.HeaderId}

In the controller, handle the event – ‘deleteLine’.

if ("deleteLine".equals(pageContext.getParameter(EVENT_PARAM)))
{
//Handle delete logic here. You can call AM methods which eventually calls PLSQL Procedures to delete the data.
}

Similarly you can add image link for update also.

Do not forget to reset the VO after operation to reflect the new data.

Advertisements

Naming Standards of Commonly Used OAF Components


1] Naming Standards for a Custom Package:

If you want to create new pages, business logic, or whole applications and deploy your code with existing Oracle E-Business Suite applications, you must define a new application and use its short name for any related package and seed data definitions. For example, if you want to create a new, custom Procurement application, you might create a product with the short name XXPO (the “XX” prefix ensures that your selected product short name never conflicts with any future Oracle E-Business Suite product names).

Any objects that you create — either by extending (subclassing) existing Oracle E-Business Suite objects or by creating new objects from scratch — must be added to a package that starts with your company’s identifier:

<myCompanyName>.oracle.apps….

  • If you are creating new objects from scratch, you should put them in a package that also includes your custom application short name as follows:

<myCompanyName>.oracle.apps.<customProductShortName>….

For example, assuming your company is called ABC Corporation and your custom product short code is XXPO, any new classes and OA Components that you create should be added to the following package:

abc.oracle.apps.xxpo….

  • If you are extending existing Oracle-Business Suite objects, you may add your files to a package that corresponds directly to the original Oracle package (in this case, you don’t need to add your files to a package including a custom application short code).

2] Naming Standards for a Page (File Extension: .xml):

The page name should convey the object it presents (an employee, a supplier, an item, a purchase order, an applicant, and so on), and the function being performed (search, promote, hire, approve, view). For some pages, the object is sufficient.

<Object><Function>PG or <Object>PG

Examples:

  • SuppliersPG.xml (Supplier update)
  • SupplierCreatePG.xml (differentiated only if update and create are separate tasks)
  • SupplierViewPG.xml (view supplier info)
  • SupplierSearchPG.xml (search for supplier)
  • SupplierHomePG.xml (Supplier home page)

3] Naming Standards for a Region (File Extension: .xml):

The region name should convey the object it presents (an employee, a supplier, an item, a purchase order, an applicant, and so on), and the function being performed or the structure (search, promote, hire, approve, view, table, HGrid, Tree and so on).

<Object><Function-Structure>RN or <Object>RN

Examples:

  • SupplierDetailsRN.xml
  • PoApproveRN.xml
  • CustomerContactsRN.xml
  • ItemTypeHGridRN.xml 

4] Naming Standards for an Entity Object (File Extension: .xml, .java):

The EO should be named for the objects stored in its underlying entity. For example, the entity FWK_TBX_PO_HEADERS stores purchase order headers, so the associated EO name is PurchaseOrderHeaderEO.

<EntityName>EO

Examples:

  • EmployeeEO.xml
  • EmployeeEOImpl.java
  • SupplierEO.xml
  • SupplierEOImpl.java
  • SupplierSiteEO.xml
  • SupplierSiteEOImpl.java
  • PurchaseOrderHeaderEO.xml
  • PurchaseOrderHeaderEOImpl.java
  • PurchaseOrderLineEO.xml
  • PurchaseOrderLineEOImpl.java

5] Naming Standards for an Entity Association Object (File Extension: .xml):

The AO name should convey the relationship between a parent and its child entities.

<Parent>To<Child>AO

Examples:

  • PoHeaderToLinesAO.xml
  • SupplierToSitesAO.xml
  • EmployeeToContactsAO.xml

6] Naming Standards for a View Object (File Extension: .xml, .java):

The VO name should convey the nature of the query. VO names are always plural as they model a collection of rows.

<DescriptiveName>VO

Examples:

  • AllEmployeesVO.xml
  • AllEmployeesVOImpl.java
  • AllEmployeesVORowImpl.java
  • NewCustomersVO.xml
  • NewCustomersVOImpl.java
  • NewCustomersVORowImpl.java

7] Naming Standards for a View Link (File Extension: .xml):

The VL name should convey the relationship between the master and detail VOs.

<Master>To<Detail>VL

Examples:

  • EmployeeToDepartmenstVL.xml
  • PoHeaderToLinesVL.xml
  • ItemToApprovedSuppliersVL.xml

8] Naming Standards for an Application Module (File Extension: .xml, .java):

The AM name should convey the purpose of the UI module it services.

<ModuleName>AM

Examples:

  • EmployeesAM.xml
  • EmployeesAM.java (optional interface)
  • EmployeesAMImpl.java
  • ItemCatalogAM.xml
  • ItemCatalogAMImpl.java
  • PoSummaryAM.xml
  • PoSummaryAMImpl.java
  • ApprovedSupplierListAM.xml
  • ApprovedSupplierListAMImpl.java

Build a Create Page in OAF!


Here I am posting a step by step tutorial to build a simple CREATE page in OAF. It is a continuation of an earlier tutorial and so you need to go through that first before going through this.

Here is the link: Build Simple Search Page in OAF

Step1: Build a Create Button

  • Select the view EmpSearchPG, right click and select New > TableActions. One region (region1) will be created with region style as ‘FlowLayout’.
  • Change the ID of the above newly created region to ButtonLayoutRN.
  • Right click ButtonLayoutRN and create a new Item.
  • Set the below details for the Item
    • ID :Create
    • Item Style : submitButton
    • Attribute Set: /oracle/apps/fnd/framework/toolbox/attributesets/FwkTbxEmployees/CreateEmployee
    • Action Type: fireAction
    • Event: create

Step 2: Set a Controller

  • Right click PageLayoutRN and select ‘Set New Controller’.
  • Give the package name as ‘xxhci.oracle.apps.custom.LabExamples.webui’.
  • Give the class name as EmpSearchCO.

Add the following logic to processFormRequest of EmpSearchCO.java after super.processFormRequest method.

if (pageContext.getParameter("event").equalsIgnoreCase("create")) {
System.out.println("EmpSearchCO: processing create/update");
pageContext.setForwardURL("OA.jsp?page=/xxhci/oracle/apps/custom/LabExamples/webui/EmployeeCreatePG",
null,
OAWebBeanConstants.KEEP_MENU_CONTEXT,
null, null, true,
OAWebBeanConstants.ADD_BREAD_CRUMB_YES,
OAWebBeanConstants.IGNORE_MESSAGES);
}

You might get red lines under java classes which are not imported. Bring the cursor on these red-lined text and click Alt+Enter (JDev automatically tells you to import the class using Alt+Enter when you move cursor over these lines).

Step 3: Build the Create Employee Page (EmployeeCreatePG)

  • Right click on Project >New >Web Tier >OA Components à Page.
  • Set the Page name as EmployeeCreatePG
  • Set the package name as xxhci.oracle.apps.custom.LabExamples.webui
  • Select the pageLayout region of EmployeePG and assign the properties as below
    ID : PageLayoutRN
    AM Definition : xxhci.oracle.apps.custom.LabExamples.server.XxhciOafTrngEmpTabAM
    Window Title : Employee Window
    Title: Employee
    Warn About Change: True

Step 4: Add items to Create Employee Page

  • Create a region under PageLayoutRN and assign ID as PageButtonsRN.
  • Set the region style as pageButtonBar

Now we need to create two buttons in this region as APPLY and CANCEL.

For Apply Button:

  • Right click on PageButtonsRN > New > Item.
  • Set the properties as
    ID :Apply
    Item Style :submitButton
    Attribute Set : /oracle/apps/fnd/attributesets/Buttons/Apply
    Additional Text :Click to save the transaction
  • Action Type: fireAction
  • Event: Apply

For Cancel Button:

  • Right click on PageButtonsRN > New > Item.
  • Set the properties as
    ID : Cancel
    Item Style : submitButton
    Attribute Set :/oracle/apps/fnd/attributesets/Buttons/Cancel
    Additional Text : Click to cancel the transaction
  • Action Type: fireAction
  • Event: Cancel

For text items in page: Right click on PageLayoutRN à New à Region using wizard. Enter data as shown in below screenshots

Step 4.1: Select AM and VO instance created during search page

Step 4.2: Give Region ID as MainRN and Region Style as defaultSingleColumn

Step 4.3: Select attributes as below (EmpNo, EmpName and Department)

Step 4.4: Change the prompts of items as shown below (messageInputText)

Click on finish for step 5.

Change the Region Style for MainRN to messageComponentLayout. This is done now as above region wizard, doesn’t have support for messageComponentLayout. Click on Yes button when the confirm window pops for change of region style.

Step5: Adding Model Layer Code

Add following code to XxhciOafTrngEmpTabAMImpl.java. Add import statements at the start and rest of the methods with the class definition.

import oracle.jbo.Row;
import oracle.apps.fnd.framework.OAViewObject;
import oracle.jbo.Transaction;
import oracle.jbo.domain.Number;
import oracle.jbo.RowSetIterator;

       // Creates a new employee.

        public void createEmployee()
        {
        OAViewObject vo = (OAViewObject)getXxhciOafTrngEmpTabEOView1();
        // Per the coding standards, this is the proper way to initialize a
        // VO that is used for both inserts and queries. See View Objects
        // in Detail in the Developer's Guide for additional information.
        if (!vo.isPreparedForExecution())
        {
        vo.executeQuery();
        }
        Row row = vo.createRow();
        vo.insertRow(row);
        // Required per OA Framework Model Coding Standard M69
        row.setNewRowState(Row.STATUS_INITIALIZED);
        } // end createEmployee()

         // Executes a rollback including the database and the middle tier.

         public void rollbackEmployee()
         {
         Transaction txn = getTransaction();
         // This small optimization ensures that we don't perform a rollback
         // if we don't have to.
         if (txn.isDirty())
         {
         txn.rollback();
         }
         }

        //Commits the transaction.

        public void apply()
        {
        getTransaction().commit();
        }

Add the following import statement and modify the create method in XxhciOafTrngEmpTabEOImpl as follows:

Add this as a part of import statements

import oracle.apps.fnd.framework.server.OADBTransaction;

Modify the create method as below

    public void create(AttributeList attributeList) {
        super.create(attributeList);
        OADBTransaction transaction = getOADBTransaction();
        Number employeeId = transaction.getSequenceValue("FWK_TBX_EMPLOYEES_S");
        setEmpNo(employeeId.toString());
    }

Step6: Add Controller logic for Create Employee Page

Right click on PageLayoutRN of EmployeeCreatePG > Set New Controller.

Give the values as
Package : xxhci.oracle.apps.custom.LabExamples.webui
Class Name : EmployeeCO

Add the below code to the new CO

Import Statements:

import java.io.Serializable;
import oracle.apps.fnd.common.MessageToken;
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.framework.OAViewObject;
import oracle.apps.fnd.framework.webui.OADialogPage;
import oracle.apps.fnd.framework.webui.OAWebBeanConstants;

processRequest (after super.processRequest):

            if (!pageContext.isBackNavigationFired(false)) {
                OAApplicationModule am =
                    pageContext.getApplicationModule(webBean);
                am.invokeMethod("createEmployee");
            } else {
                // We got here through some use of the browser "Back" button, so we
                // want to display a stale data error and disallow access to the
                OADialogPage dialogPage = new OADialogPage(STATE_LOSS_ERROR);
                pageContext.redirectToDialogPage(dialogPage);
            }

processFormRequest (after super.processFormRequest):

      OAApplicationModule am = pageContext.getApplicationModule(webBean);
          // Pressing the "Apply" button means the transaction should be validated
          // and committed.
      if (pageContext.getParameter("event").equalsIgnoreCase("Apply")) {
                   OAViewObject vo =
                      (OAViewObject)am.findViewObject("XxhciOafTrngEmpTabEOView1");
                  String employeeName =
                      (String)vo.getCurrentRow().getAttribute("EmpName");
                  String employeeNum =
                      (String)vo.getCurrentRow().getAttribute("EmpNo");
                  am.invokeMethod("apply");
                  MessageToken[] tokens =
                  { new MessageToken("EMP_NAME", employeeName),
                    new MessageToken("EMP_NUMBER", employeeNum) };
                  OAException confirmMessage =
                      new OAException("AK", "FWK_TBX_T_EMP_CREATE_CONFIRM", tokens,
                                      OAException.CONFIRMATION, null);
                  pageContext.putDialogMessage(confirmMessage);
                      pageContext.forwardImmediately("OA.jsp?page=/xxhci/oracle/apps/custom/labExamples/webui/EmpSearchPG",
                                                     null,
                                                     OAWebBeanConstants.KEEP_MENU_CONTEXT,
                                                     null, null, true,
                                                     OAWebBeanConstants.ADD_BREAD_CRUMB_NO);
              }
      // If Cancel button is pressed, rollback the transaction
       else if (pageContext.getParameter("event").equalsIgnoreCase("Cancel")) {
                  am.invokeMethod("rollbackEmployee");
                      pageContext.forwardImmediately("OA.jsp?page=/xxhci/oracle/apps/custom/labExamples/webui/EmpSearchPG",
                                                     null,
                                                     OAWebBeanConstants.KEEP_MENU_CONTEXT,
                                                     null, null, false,
                                                     OAWebBeanConstants.ADD_BREAD_CRUMB_NO);

              }

Step 7: Save all and Run the EmpSearchPG to test the page

Flow Diagram

The Final Output:

Build simple search page in OA Framework


Here are the steps to create a simple search page in OA Framwork. I have used OAF Version 12.1.1 for this exercise. There are many ways to do this and here I have followed one of these.

Step 1: Create a Package

All BC4J model components must belong to a Business Components (BC4J) package. So create a package with a name like xxhci.oracle.apps.custom.LabExamples.server.


Step2: Create an Entity Object (EO)

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

To create a new entity object in the above defined Business Components (BC4J) package:

1. In the JDeveloper Navigator, select the BC4J package where you want to create your entity object.

2. Right click and select ‘New Entity Object’

3. Do the following steps to create an EO.

2.1 Specify a Schema Object (the exact name of the table for the entity object)

2.2 In the Attributes page (Step 2 of 5), you should see all the columns in the table that you specified in the Name page.

Select New… to create a transient attribute that is used in the business logic, such as a calculated OrderTotal in a purchase order that is used for approval checking.

2.3 In the Attribute Settings page (Step 3 of 5), verify or set the following information for each of the entity object’s attributes:

The Attribute and Database Column Name and Type properties default correctly from the table definition. For primary key columns, ensure that the Primary Key and Mandatory checkboxes are selected. For columns that are never updateable, or updateable only when new, select the appropriate Updateable radio button. For columns whose values change after database triggers execute, select the Refresh After update or insert as appropriate.

2.4 In the Java page (Step 4 of 5) page:

  • Check the option for generating an Entity Object Class. In the Generate Methods box, opt to generate Accessors, a Create Method and a Remove Method.

2.5 Click on ‘Generate default view object’ to create a VO. Select Finish to save your entity object definition and implementation. BC4J will create an XML definition file and a Java implementation file for your entity object.

Step3: Create an View Object (VO)

If you click ‘Generate default view object’ tab as mentioned above, you don’t have to create a VO separately. If you forgot this, you have to create a VO. Click on the VO to test the SQL Statement generated by the EO and check in the ‘Expert Mode’.

Step4: Create a New Application Module (AM)

To create a new application module in a Business Components (BC4J) package:

1. In the JDeveloper Navigator, select the BC4J package where you want to create your application module.

2. From the main menu, choose File > New to open the New Object Gallery.

Select the view object.

In the Java page (Step 4 of 5), deselect the Generate Java File(s) checkbox ONLY if you are certain that you won’t be writing any code for your application module (you can always delete the class later if you find that you don’t need it, so it’s probably best to simply generate it at this point unless you are creating a simple container for LOV view objects).

Select Finish to create your application module. BC4J will create an XML definition and implementation file.

Step5: Create a Page (EmpSearchPG)

Create the EmpSearchPG page as follows

  • Right click on project à New à Web Tier à OA Components à Page
  • Give the Page Name as EmpSearchPG and package as “xxhci.oracle.apps.custom.LabExamples.webui”
  • Select region1 page from Structure Window and change its properties as
    ID à PageLayoutRN
  • Select the AM Definition as ‘xxhci.oracle.apps.custom.LabExamples.server.XxhciOafTrngEmpTabAM’
  • Give a Window Title as ‘Employees Search Window’
  • Give a Title as ‘Employees’

Step6: Add a Query region and Results table

  • Right click on PageLayoutRN à New à Region. Set the properties of the new region as
    ID à QueryRN
  • Select the Region Style as ‘query’ and Construction Mode as ‘resultBasedSearch’.
  • Right click on QueryRN region on structure navigator à New à Region using wizard.
  • Select the AM and VO which we have created in earlier steps as shown in below figure.


Set the Region Style as Table

Change the Prompt and Style for all three items.

Step7: Changes the Item Properties

Go to EmpNo item and set the Search Allowed property to true. Similarly do the steps for EmpName and Department also.

Step8: Save all changes (Save All).

Step9: Run the Page (EmpSearchPG)

Creation of search page is complete. Run the EmpSearchPG to test the page. If everything works fine for you, you should able to view an output like below:

Few Note:

Understanding Query Regions

When you add a query region to a pageLayout region, OA Framework automatically generates an oracle.apps.fnd.framework.webui.beans.layout.OAQueryBean which, depending on its configuration, works in concert with a child table, advanced table or HGrid to implement any combination of simple search, advanced search and view panels. OA Framework automatically generates buttons as appropriate for toggling between the applicable regions.

Construction Modes:

There are three construction modes available. In the above example we have used ‘resultBasedSearch’ construction mode. Here is a brief comparison of the three modes.

1] resultsBasedSearch:

  • OA Framework automatically renders both the Simple and Advanced search regions based on the designated queryable items in the associated table.
  • The search regions automatically include both a Go and a Clear button.
  • OA Framework automatically executes the underlying search when the user selects the Go button.

2] autoCustomizationCriteria:

  • OA Framework automatically renders both the Simple and Advanced search regions based on the corresponding Simple search and Advanced search regions that you define and specify as named children of the query region.
  • The search regions automatically include a Go button. In addition, the Advanced search region includes a Clear button.
  • OA Framework automatically executes the underlying search when the user selects the Go button. However, developers must explicitly define mappings between items in the Search panel and items in the table region.

3] none

  • The Search regions are rendered based on the Simple Search and Advanced Search regions that you define and specify as named children of the query region.
  • You must implement your own Go button in this mode.
  • The underlying search must be executed by the developer.

OAF vs ADF 10g


With the emergence of next generation Fusion technology middleware stack there is confusion between the technologies OA framework and ADF among Oracle developers especially for the people who are developing extensions for Oracle Applications 11i/R12. Both are Oracle technologies for developing web based User Interface with Jdeveloper. Here is a detailed overview of OA framework and ADF.

OA Framework:

OAF (Oracle Applications Framework) is used to create the web based Oracle Application extensions and it is the default web technology for 11i and R12 development. It is closely integrated with Oracle Apps hence it is meaningless outside apps context. OAF is a model-view-controller technology stack which comprised of OA framework View (regions and pages) and BC4j respectively as view and model layers.

OAF and Oracle Applications 11i/R12

  • OAF includes AOL which provides e-business functionality like functions, menus, responsibility, functional security, data security, messages, profiles, flexfields, and concurrent programs.
  • List of Values – validation, auto complete, auto clear is available in OAF.
  • Transactional Search – Query Bean is available in OAF.
  • Data export, Configurable pages and Rich text editor is available in OAF.
  • OAF supports translatable table (TL tables).
  • Who columns like created by, modified by, creation date, modified date are supported in OAF.
  • Since OAF is tightly integrated with E-Business session management is done automatically.
  • Menu that appears at the top of the page is integrated with AOL menus. Hence the menus can be configured dynamically by manipulating AOL menus and no coding is required.
  • Functional security is available in OAF which allows you to configure the responsibility dynamically for the user.
  • User authentication is done from SSO. So no need to configure or write any code.
  • Data security is available.
  • Secured against cross site scripting attack.
  • OAF page access can be tracked.
  • Standards and guidelines are available for developing extensions in OAF which is the most important thing.
  • Reusable regions are available in OAF.
  • UI cannot be migrated to ADF 11g (may be in the future Oracle will come up with migration utility for UI but even then only declarative pages would be migrated and the UI pages should have followed the coding standards strictly).
  • BC4J can be migrated with minimal code change.
  • Controller cannot be migrated hence you have to rewrite all the logics in the controller if you want to migrate it to ADF 11g.

ADF 10g

ADF 10g (Application Development Framework) is the core technology for Fusion Applications and uses lot of open standards and technologies. ADF can also be used for common J2EE applications because ADF technology stack allows you choose between various options. ADF is primarily comprised of ADF Faces, ADF model and ADFbc (which is previously known as bc4j in OAF)

ADF 10g and Oracle Applications 11i/R12

  • ADF 10g does not include any support for AOL
  • List of Values and its associated features like validation, auto complete and clear does not exists in ADF.
  • No Transactional search, Data Export, Configurable pages or Rich text editor.
  • No support of Translatable Table and who columns.
  • No support for E-business suite session management.
  • No support for integration with Oracle Workflow.
  • E-business security features are totally unavailable in ADF 10g. (security features include Data security, functionally security, SSO etc)
  • Page access cannot be tracked in ADF 10g.
  • No support of for menus in ADF.
  • Reusable regions cannot be created in ADF 10g.
  • ADF 10g can be easily migrated to ADF 11g.
  • And most of all you cannot extend or personalize the existing page with the help of ADF.

And the advantage of ADF 10g over OA framework is that your investments would be protected when you want to migrate to ADF 11g.

ADF has many advantages starting from the underlying architecture, the level of support for Web Services and SOA development and going all the way to the actual development experience of UIs using visual editor and drag and drop binding. 

Conclusion

Consider following points when choosing technology.

  • If you want to build few pages with close integration of e-business suite then opt for OA framework. Remember if you want to migrate your code to ADF 11g in the future, you have to follow the coding standards strictly and code all the business logic in bc4j rather than handling the logic in controller.
  • If you don’t want a close integration e-business suite or your building entirely new application then go for ADF 10g. 
Reference: prasanna-adf.blogspot.com

Personalization vs Extension vs Customization


In Oracle EBS development, the terms Personalization, Customizations & Extensions are often used interchangeably. It often creates confusion among developers regarding the meaning of these terms. These terms are critically important terms that developers must understand and use properly. Let’s discuss them briefly here to simply understand what they are.

What is Personalization?

Personalization is the process of making changes to the User Interface (UI) from within an Oracle E-Business Suite Form/Page. It is possible to make personalization to both Form-based and OA Framework based pages.

What is Extension?

Extension is the process of making changes to the programmatic (i.e., PL/SQL or Java) elements of an E-Business Suite form/page. It is possible to extend both Forms based and OA Framework-based pages.

What is Customization?

Customization is the process of creating new forms/pages. While Oracle does provide tools to do this (i.e., Oracle Forms and JDeveloper 10g with OA Extension), this is the least supported option.

Create Hello World Page in OAF!


This tutorial will tell you the basic steps to create a Hello Word Page in OA Framework.

Earlier Posts:

1] Initial Setup in JDeveloper for OAF Development

2] Run Oracle Defined Hello World Page

Step 1: Start JDeveloper. Create a New OA Workspace and Empty OA Project with the New…Dialog


Step 2: Create the OA Component Page

JDeveloper creates your top-level page layout region for you automatically when you create your page.

Step 3: Modify the Page Layout (Top-level) Region

  • Set the ID property to PageLayoutRN.
  • Verify that the Region Style property is set to pageLayout.
  • Verify that the Form property is set to True.
  • Verify that the Auto Footer property is set to True.
  • Set the Window Title property to <your name>: Hello World Window Title. This becomes the window title for the page.
  • Set the Title property to <your name>: Hello World Page Header.
  • Set the AM Definition property to oracle.apps.fnd.framework.server.OAApplicationModule (you will have to type in the value). This is a generic application module supplied by the OA Framework.

Step 4: Create the Second Region (Main Content Region)

Create your second region under the page layout region by selecting the page layout region in the Structure window and choosing New > Region from the context menu.

  • Replace the default value in the ID property with MainRN.
  • Set the Region Style property to messageComponentLayout (this provides an indented single- or multiple-column layout for the child items of the region).

Step 5: Create the First Item (Empty Field)

Create your first item under the second region (main content region) by selecting the second region in the Structure window and choosing New > messageTextInput from the context menu. This item will take any name as parameter.

  • Set the ID property to HelloName.
  • Verify that your Item Style property is set to messageTextInput (this style provides a text label and an input field).
  • Set the Prompt property to Name.
  • Set the Visual Length to 20.
  • Set the Data Maximum Length to 50.

Step 6: Create a Container Region for the Go Button

To add a non-message-type bean such as a submitButton to a messageComponentLayout region, you must first add the bean to a messageLayout region.

Select the messageComponentLayout region and select New > messageLayout.


Name this region ButtonLayout.

Step 7: Create the Second Item (Go Button)

Create your Go button item by selecting the messageLayout region, ButtonLayout, in the Structure window and choosing New > Item from the context menu.

Set the following properties for your button item:

  • Set the value of the ID property to Go.
  • Set the Item Style property to submitButton.
  • Set the Attribute Set property to /oracle/apps/fnd/attributesets/Buttons/Go.


Step 8: Save Your Work (Save-All)

Step 9: Run Your Page Using the Run Option

You can try out your page using the Run option on the context menu. If you are using a database other than what you already have in your project settings, you will need to modify the Runtime Connection project settings by selection your project file and choosing Project Properties… from the main menu. Specifically, you must use a combination of Username, Password, (Responsibility) Application Short Name and Responsibility Key that is valid for your database to enable your session to log in.

The output will be like:


Here the Go Button has no functionality. Now to add some functionality to this Button, we need to add a Controller.

Step 10: Add a Controller

Add a controller to display a message when the user clicks on the Go button. Select your second region (MainRN) and choose Set New Controller… from the context menu.

Step 11: Edit Your Controller


When you create a controller .java file will be automatically created and it will contain below 2 methods.

  • public void processRequest(OAPageContext pageContext, OAWebBean webBean) { }
  • public void processFormRequest(OAPageContext pageContext, OAWebBean webBean) { }

Now you need to add the below code in the java file to add the required functionality.

  • Add the following line as the last line of the import section to make the OA Framework OAException routines available:
import oracle.apps.fnd.framework.OAException;
  • Add the below code in processFormRequest method
      if (pageContext.getParameter("Go") != null)
      {
      String userContent = pageContext.getParameter("HelloName");
      String message = "Hello, " + userContent + "!";
      throw new OAException(message, OAException.INFORMATION);
      }

Step 12: Build Your Controller

Build your controller by selecting Rebuild from the context menu within the code editor window.

Step 13: Test Your Work Using the Run Option

Save your work, and then test it using the Run option. Type something into your field and then click the Go button. You should see the page with an informational message that contains what you typed into the field, as shown:

Congratulations…! You have created your first OA Page. I will try to put articles on how to create search, create and update page in OAF in future. See ya!

My First Hello World Page in OA Framework!


My First Hello World Page in OA Framework!

If you are new to OAF Development and want to create a new Hello World Page, then this tutorial will help you. For that first you need to do a Setup to use JDeveloper to develop and run your OA Pages.

You can refer here for that.

After the Setup is completed, you are all set to run your first OA Page. Oracle itself has created the Hello World page for you! Just go through the below steps to run the page.

1] Open Oracle JDeveloper and go to File > Open. Open the “toolbox.jws” file from the location \jdevhome\jdev\myprojects.

2] Right click on Tutorial and then click on Project properties.

3] Go to Oracle Applications > Database Connections tab

4] Click on New to create a new database connection. Choose the Connection Type as Oracle (JDBC).

5] Give your Oracle Apps database username and password.

6] Choose the thin driver and give Host Name, Port and SID details of your Oracle Application Database Server. You can get the details in your tnsnames.ora file.

7] After that click on Test Connection button to check if the JDeveloper can connect to the specified database or not. If the status is success then go ahead or check the above settings if you get different status.

8] Go to Run Options and select OADiagnostic and OADeveloperMode.

9] In the Runtime Connection tab, add the path of your DBC file name and give your Oracle Apps username and password. Click Ok. Also add Application Short Name as AK and Responsibility Key as FWK_TBX_TUTORIAL.

10] Go to Oracle Application Front end and add the responsibilities “OA Framework ToolBox Tutorial” & “OA Framework ToolBox Tutorial Labs” to the user that you have added on the Runtime Connection tab above.

11] Now right click on Tutorial and Rebuild the project. You should get zero errors. If you get few warnings it is ok.

12] Now go to toolbox > Tutorial > Web Content and Run the test_fwktutorial.jsp page.

13] Click on Hello, World!


14] Here is your Hello World page.

You might get errors while running the project. Here I have listed such few errors and their solutions.

Error: oracle.apps.fnd.framework.OAException: Application: ICX, Message Name: Could not find the specified responsibility.

Solution :

1 . Check that the user name and password are correct in the project settings.(Make sure to give Application username and password.)

2. Check the Responsibility key and Application short name.

3. Check whether the user name given in point #1 is attached to the responsibility mentioned in the point #2.

4. Check your dbc file for correct settings.

Error: oracle.apps.fnd.framework.OAException: Application: FND, Message Name: FND_GENERIC_MESSAGE. Tokens: MESSAGE = java.lang.NullPointerException;

Solution :

Set profile “Sign-On:Notification” to “No” at site level.

Initial Setup in JDeveloper for OAF Development


Initial Setup in JDeveloper for OAF Development

 

If you want to do some OAF Development in JDeveloper for the first time, you will need to do the following things.

1] Download JDeveloper Patch

Based on your instance release level, check out the version of JDeveloper to use using below link.

https://support.oracle.com/CSP/main/article?cmd=show&type=NOT&id=416708.1

You can identify the OA Framework version in your instance by activating diagnostics and click the “About This Page” from any OAF page. Click the “Technology Components” tab. The OA Framework version in the top row of the table can then be matched to the JDeveloper Patch.

Download the JDeveloper Patch.

2] Extract the JDeveloper patch in a directory say D:\DevSuiteHome_1\jdev

The patch actually contains below three directories

  • jdevbin – Includes an extended version of the Oracle JDeveloper 10g executable and OA Framework class libraries.
  • jdevhome – Includes the OA Framework Toolbox Tutorial source and developer working area.
  • jdevdoc – Contains documentation.

3] Define an environment variable

Define an environment variable JDEV_USER_HOME for your local machine. This has to be set to jdevhome\jdev directory. In above example it has to be D:\DevSuiteHome_1\jdev\jdevhome\jdev.

My Computer Properties Advanced tab Environment Variables New

Variable: JDEV_USER_HOME

Value: D:\DevSuiteHome_1\jdev\jdevhome\jdev

4] Extract Tutorial.zip

Extract D:\DevSuiteHome_1\jdev \jdevbin\Tutorial.zip into D:\DevSuiteHome_1\jdev \jdevhome.

It will create following directories

D:\DevSuiteHome_1\jdev \jdevhome\jdev\myhtml

D:\DevSuiteHome_1\jdev \jdevhome\jdev\myprojects

5] Get the DBC file

Obtain the FND database connection (.dbc) file from the system administrator who installed the OA Framework database where you want to do your development.

For the instance to use, you can get the .dbc file from $FND_SECURE and put it in <JDEV_USER_HOME>\dbc_files\secure i.e. D:\DevSuiteHome_1\jdev\jdevhome\jdev \dbc_files\secure

6] Creating a Desktop Shortcut to JDeveloper

To facilitate launching JDeveloper, create a desktop shortcut to jdevbin\jdev\bin\jdevw.exe.

7] Configuring the Environment Encoding of JDeveloper

Confirm the environment encoding of your JDeveloper if it is appropriately set.

Go to Tools – Preferences – Environment – Encoding

If Encoding is not set to “UTF-8”, set it to “UTF-8”.

The initial setup is now complete!….Now you are ready to develop your first OAF page. For more information you can refer OAF Developer’s Guide.