Tuesday, May 14, 2013

JDeveloper setup for OAF

Following are some basic steps to be followed to setup JDeveloper for application development using OAF (Oracle Applications Framework).

1. Find out the ATG version of your application. To find ATG version login to the application. Click on About this Page link. Click on Technology Components Tab. Find out the OA Framework version. This is nothing but the ATG version

 
 
2. Login to Oracle Support and search for Note How to find the correct version of JDeveloper to use with eBusiness Suite 11i or Release 12.x [ID 416708.1].
This gives the details of ATG versus JDeveloper. Using the patch links download the JDeveloper.
 


 
3. Decide the location where you want your OAF projects sitting on your hard drive and set that as the environment variable for JDEV_USER_HOME. For example JDEV_USER_HOME can be set to H:\OAFJdeveloper\jdevhome\jdev\
 
 
 

OAF - Create a simple display page

In this blog, we will create a page to display data from the table


Open the JDeveloper. Here we consider the user to be aware of how to use the JDeveloper. Create a project, configure design time and run time connection parameters.
 
Create Table CONTACTS
Create XX_CONTACTS (CONTACT_ID, FIRST_NAME, LAST_NAME, EMAIL_ADDRESS, MOBILE_PHONE, HOME_PHONE) table using the following script.

CREATE TABLE xx_contacts( contact_id NUMBER
, first_nameVARCHAR2(100)
, last_nameVARCHAR2(100)
, email_addressVARCHAR2(100)
, mobile_phoneVARCHAR2(100)
, home_phoneVARCHAR2(100)
, created_by NUMBER
, creation_date DATE
, last_update_by NUMBER
, last_updated_dateDATE
, last_update_loginNUMBER);

In this table the last five columns, called who columns, are used for auditing purposes and to track the owner of the records in the table.

Create Entity Object

1. Click on project and click on New.

2. Select ADF Business Components in the Business Tier under Categories section > Select Entity Object in the Items secion. Click Ok button.

3. Select APPS for Database Schema, XX_CONTACTS (table created in Create Table section). Provide ContactsEO for the Name of Entity Object, enter oracle.apps.inv.ctc.schema.server for package. Entity Objects are in general created in schema package. Click Next.

4. Accept the defaults in steps 2 to 5. Navigate to Finish page that shows the Attributes. Click Finish on this page.

5. This creates ContactsEO in package oracle.apps.inv.ctc.server.schemapakage

Create View Object
1. Right click on package ctc and click on New

2. Enter oracle.apps.inv.ctc.server for package and ContactsVO for View Object name and click Next

3. On Entity Objects page select ContactsEO from the Available and move to Right by clickin on “>” button.


4. On Attributes page click on “>>” button to select all the available attributes from ContactsEO to ContactsVO.

5. On the following pages accept default values and click next on pages Step 4 to Step 7 to go to Finish page. Click Finish button on this page to create ContactsVO.

6. These steps create ContactsVO in package oracle.apps.inv.ctc.server

Create Application Module
1. Right click on server and click on New Application Module


2. Enter oracle.apps.inv.ctc.server for package and ContactsAM for Name and click Next


3. On VO selection page select ContactsVO from package oracle.apps.ctc.server and click on “>” button to assicateattacheContactsVO instance to this Application Module. Rename the instance Name to ContactsVO. Click Next.


4. Accept the defaults on Step3 and Step4 pages and click Next button to navigate to Finish page, where we can see ContactsVO instance being attached to this Application Module. Click Finish to complete AM creation.


5. Now the AM is available under oracle.apps.inv.ctc.server package. Select ContactsAM, Now in this AM ContactsVO has to be initialized to get the values from the table. In the Structure panel down there, double click on ContactsAMImpl.java file to edit the code.


6. Edit the ContactsAMImpl.java to add code to initialize ContactsVO as shown in the selected section of below figure.

7. Save the project by clicking on Save all button

 

Create page ContactsPGalong with a Controller
1. Right click on project and click on New

2. Select OA Components under Web Tier > Select Page under Items. Click on OK button


3. Enter ContactsPG for Name and oracle.apps.inv.ctc.webui for package and click OK to create page ContactsPG under package oracle.apps.inv.ctc.webui.


 
Once the page is created, in property inspector add AM Definition = oracle.apps.inv.ctc.server.ContactsAM

4. Now select the ContactsPG, select region1 and change the ID of this region on Property Inspector panel on rightside. In this example ContactPG is the ID provided for region1.
 


5. Rightclick on ContactsPG region, and add new region. Name it as ContactsHdr and change the Region Style to Header.

6. Similarly add a table region under ContactsHdr.

7. Right click on ContactsPG, then click on Set New Controller.

8. Enter oracle.apps.inv.ctc.webui for package and ContactsCO for name and click Ok to create a controller. Once the controller is created, open the controller code and add the code that calls Application Module, which initializes the ContactsVO.

9. Under ContactsTbl table, add additional items to display the contact details.

10. Change the properties of this item to add view instance, view attribute and prompt in the property inspector.

11. Likewise create additional items under the table structure.

Run the page to see contacts.
Right click on ContactPG and click on RUN to see the results.

Final output:
 
       

ADF Faces Skinning

Demo: ADF Skinning Editor


This video demonstration shows, how to create a new look and feel for your applications, using the ADF Skinning Editor.

Launch Demonstration

Building an ADF Application - Demo

This video demonstration shows how to develop an Oracle ADF application. In this demonstration, you see how to:

  • Create a new Fusion web application
  • Create ADF Business Components and add validation
  • Create a new JSF page and arrange layout components, such as tabs, on the page
  • Drag and drop data controls onto a page to create data-bound components, such as tables, buttons, and visual components like graphs
  • Create a Java class and expose it as a data control
  • Create an ADF task flow and expose it as a region on a page
  • Run the application and view it in a browser
The below video is from Oracle eLearning Library

Launch Demonstration

Monday, May 13, 2013

Launch Workflow from OAF Page

Using class oracle.apps.fnd.framework.webui.OANavigation provided by Oracle for Workflow API, you can launch workflow directly from OAF Page.  There are two ways to launch workflow :

1.  Oracle PL/SQL API (wf_engine)
2.  Java Wrappers

In this blog, we shall launch a workflow from OAF page.

1.  Create a submit button and name the partial event as "launchWF"
2.  Write below java procedure to invoke workflow

import oracle.apps.fnd.framework.webui.OANavigation;

    public void launchWF(OAPageContext pageContext)
    {
        String PItemType = "XXSALES";
        String PProcess = "SALES_WF";
        String PItemKey = "SALES-001";  // This can be a random item key generated
   
        OANavigation wf = new OANavigation();
   
        // Now create Workflow Process
        wf.createProcess(pageContext, PItemType, PProcess, PItemKey);
   
        // Set Sales Order Number
        wf.setItemAttrText(pageContext, PItemType, PItemKey,"ORDER_NO", "101");
   
        // Start Workflow Process
        wf.startProcess(pageContext, PItemType, PProcess, PItemKey);

    }


3.  Call the above procedure in ProcessFormRequest Method

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

    if ("launchWF".equals(pageContext.getParameter(EVENT_PARAM)))
      {
        launchWF(pageContext);
      }
    }


Sunday, May 12, 2013

CREATE Oracle FND User API

The below scripts is for creating FND User using standard oracle API.

-- ****************************************************************
-- Filename -  CreateFndser.sql
-- Purpose  -  Script to create fnd user
-- Module   -  System Administrator
-- ****************************************************************


DECLARE 
   l_user_name               VARCHAR2(100)   := 'TestUser; 
   l_user_password           VARCHAR2(100)   := 'Oracle123'; 
   l_user_start_date         DATE            := TO_DATE('01-JAN-2012'); 
   l_user_end_date           VARCHAR2(100)   := NULL; 
   l_password_date           VARCHAR2(100)   := TO_DATE(''01-JAN-2012'); 
   l_password_lifespan_days  NUMBER          := 70; 
   l_person_id               NUMBER          := 21855; 
   l_email_address            VARCHAR2(100)   := 'TestUser@test.com';


BEGIN 
  
fnd_user_pkg.createuser 
  (  x_user_name                => l_user_name, 
     x_owner                    => NULL, 
     x_unencrypted_password     => l_user_password, 
     x_start_date               => l_user_start_date, 
     x_end_date                 => l_user_end_date, 
     x_password_date            => l_password_date, 
     x_password_lifespan_days   => l_password_lifespan_days, 
     x_employee_id              => l_person_id
 ); 
  
 COMMIT;

EXCEPTION 
       WHEN OTHERS THEN 
           
ROLLBACK; 
           DBMS_OUTPUT.PUT_LINE(SQLERRM); 
END; 
/



OAF - DB Sequence in Entity Object


There are two ways to assign database sequence value in OAF, DB sequence value can be assign to EO or at VO level.

Create sequence in database

CREATE SEQUENCE XX_EMP_SEQ START WITH 1 INCREMENT BY 1;

Assign DB sequence value in EO

Go to your EOImpl.java and write the below code in create constructor

public void create(AttributeList attributeList) {
super.create(attributeList);
OADBTransaction transaction = getOADBTransaction();
Number seqNo = transaction.getSequenceValue("XX_EMP_SEQ");
setFileId(seqNo);
}

Assign DB sequence value in VO

OAViewObject vo = (OAViewObject)findViewObject("XXEmployeesVO");
OARow row = (OARow)vo.first();
row.setAttribute("EmployeeId", getOADBTransaction().getSequenceValue("XX_EMP_SEQ").toString());