Thursday, November 7, 2013

Creating Train Region in OAF


Train Region in OAF


Now we are going to learn about, how to use the train region in oaf.

For train region.

First create one workspace and project.

Create one Application Module.

Here I am using data insertion. So create one Entity Object. (Not Mandatory)

Create one View Object and attach to AM.

Create three pages and attach the AM and set the window title and title for each pages.

The Structure of the pages are as shown below.

Train1PG

For each item set the View Instance and View Attribute.




Train2PG

For second page in the main region along with AM definition set one more property called AM State Required to TRUE.






           
Train3PG

For third page also make AM State Required to TRUE.






Next Create one new Region.

Right click on webui select new.

Webui-- > new -- >OA Component -- > Region.

Give the name for the Region

Name:-           (EmpTrainRN)

Style:-train





After creating the Region in the structure. Right click on the region select new link

Create three links.

Set the following properties for the link.

ID:-      (STEP1)

Destination URI:- Give the path of the 1 page (OA.jsp?page=/sangu/oracle/apps/po/TrainPRJ/webui/Train1PG)

Text:-    (Step1)





Repeat the same for other two links also.

ID:-      (STEP2)

Destination URI:- Give the path of the 2 page (OA.jsp?page=/sangu/oracle/apps/po/TrainPRJ/webui/Train2PG)

Text:-    (Step2)




ID:-      (STEP3)

Destination URI:- Give the path of the 3 page (OA.jsp?page=/sangu/oracle/apps/po/TrainPRJ/webui/Train3PG)

Text:-    (Step3)




Create one more region for navigation of type pageButtonBar.

Right click on webui select new.

Webui-- > new -- >OA Component -- > Region.

Give the name for the Region

Name:-           (EmpNavRN)

Style:-pageButtonBar





After creating the Region in the structure. Right click on the region select new item

Create one submit button item for save.

Id:-save
Style:-submitButton
Prompt:-save.

Create another submit button item for cancel.

Id:-cancel
Style:-submitButton
Prompt:-cancel.


Crete one region.

Style:-navigationBar

First Step:- 1

Last step :- 3




Create three links items in the navigationBar region.

Right click on the region select new item

Set the following properties for the link.


ID:-      (step1link)

Style:- link

Destination URI:-  Give the path of the 1 page (OA.jsp?page=/sangu/oracle/apps/po/TrainPRJ/webui/Train1PG)

Text:-    (Step 1 of 3)



ID:-      (step2link)

Style:- link

Destination URI:-  Give the path of the 2 page (OA.jsp?page=/sangu/oracle/apps/po/TrainPRJ/webui/Train2PG)

Text:-    (Step 2 of 3)




ID:-      (step3link)

Style:- link

Destination URI:-  Give the path of the 3 page (OA.jsp?page=/sangu/oracle/apps/po/TrainPRJ/webui/Train3PG)

Text:-    (Step 3 of 3)

The structure of the region is as follows.





After creating the EmpTrainRN region and EmpNavRN region.

Now click on your Train1PG

In this page create one Region.

Style:- pagebuttonBar

Extends:- Here give the path of your EmpNavRN region
                (/sangu/oracle/apps/po/TrainPRJ/webui/EmpNavRN)




After this now write click on main region of the page and select new location.




After creating the location it will create one region in that Extend your train Region i.e EmpTrainRN.






Repeat the same for remaining two pages also.

(One region for EmpNavRN region and one location for EmpTrainRN region)

The structure of the page looks as follows.



This finishes the Train Region Run The Page to See The Output.



U can add the data.



After clicking next button it move to next page.



After clicking next button it move to next page.




8 comments:

  1. Hi Sangu,
    I have tested the Train tutorial at your website - it works correctly (without any controller code). But when I tested the Update Train tutorial that comes with the OAF patch for EBS R12.1.3 - though I am able to move from Page 1 to Page2 by using the Next button of TrainFooter, but when I click Next again, it simply refreshes Page2 rather than launching Page3. At the following link : https://blogs.oracle.com/prajkumar/entry/implement_train_in_oaf_page I found a piece of code that needs to be incorporated in the Controller-processRequest of Train Footer - and when I modified the controller accordingly - it launched Page3 correctly. Would you know why and when it is sometimes required, and why your tutorial is working without it.
    public void processRequest(OAPageContext pageContext, OAWebBean webBean)
    {
    super.processRequest(pageContext, webBean);
    OATrainBean trainBean = (OATrainBean)pageContext.getPageLayoutBean().getLocation();
    trainBean.prepareForRendering(pageContext);
    int step = trainBean.getSelectedTrainStepRenderedIndex();
    OANavigationBarBean navBean = (OANavigationBarBean)webBean.findChildRecursive("NavBar");
    navBean.setValue(step+1);
    } // end processRequest()

    ReplyDelete
  2. Posted a message to Oracle Community and found a resolution :
    EmpNavRN(pageButtonBar) > navBarRN(navigationBar) : As long as the links are prefixed with "OA.jsp?page=" then the Step Value need not be incremented using ""navBean.setValue(step+1)" in the Controller Code. If the prefix is not included need the Step Value will need to be incremented.

    ReplyDelete
  3. Hi Sanjay,

    Thanks for posting the solution.

    Regards,
    Sangu

    ReplyDelete
  4. Hello, Can you please tell me on how to pass values from one page to another in TRAIN. Any Sample code will be highly appreciated.

    Many thanks in advance.

    ReplyDelete
  5. Hi Sangu,

    Would you please tell me why this error will occured.

    import oracle.apps.fnd.framework.server.OAEntityDefImpl;
    import oracle.apps.fnd.framework.server.OAEntityImpl;

    import oracle.jbo.Key;
    import oracle.jbo.RowIterator;
    import oracle.jbo.domain.Date;
    import oracle.jbo.domain.Number;
    import oracle.jbo.server.AttributeDefImpl;
    import oracle.jbo.server.EntityDefImpl;
    //import oracle.apps.fnd.schema.server.MenuEntryEOImpl;
    //import oracle.apps.fnd.schema.server.FunctionEOImpl;
    ---------------------------------------------------------------------
    --- File generated by Oracle ADF Business Components Design Time.
    --- Custom code may be added to this abstract class Emp1EOImpl extends OAEntityImpl {
    public static final int EMPNO = 0;
    public static final int ENAME = 1;
    public static final int JOB = 2;
    public static final int MGR = 3;
    public static final int HIREDATE = 4;
    public static final int SAL = 5;
    public static final int COMM = 6;
    public static final int DEPTNO = 7;
    public static final int MGREMPEO = 8;
    public static final int EMPEO = 9;
    private static OAEntityDefImpl mDefinitionObject;

    /**This is the default constructor (do not remove)
    */
    public Emp1EOImpl() {
    }


    Complier Log:
    --------------------
    E:\p6908968_R12_GENERIC\jdevhome\jdev\myprojects\Trains\oracle\apps\po\require\scheema\server\Emp1EOImpl.java
    Error(14,1): 'class', 'interface', or 'enum' expected

    ReplyDelete
    Replies
    1. Hi Prahlad,

      The table on which you create Entity Object must have "WHO COLUMNS" like createdby,updatedby.....
      You have created the EO on emp table it doesn't contain who columns take the table which has who columns.

      Regards,
      Sangu

      Delete
    2. U can use FWK_TBX_EMPLOYEES table.

      Delete
  6. Hi Sangu,
    I created 3 page in train region when I click on save button it's creating 3 rows in one table.

    ReplyDelete