OAF Basics

Embed Size (px)

DESCRIPTION

oaf

Citation preview

  • 5/20/2018 OAF Basics

    1/84

    Raaj NagulapalliM.C.A

    1

    ORACLE APPLICATION FRAMEWORK

    Oracle Application Framework (OA Framework) is the Oracle Applications development and deployment platform fo

    HTML-based business applications.

    Simple Web Application Architecture ( Servlet / JSP ) :

    Client Tier Application - Tier Database - Tier

    HTTP Request

    HTTP Response

    Initially Web Application was very simple ( developed in 1990s )

    Application Tier Contains a Web Server which maintains the components such as Servlet, JSP

    Component :Component is piece of code, which implements well defined interface.

    A Single Component is not an Application.

    An Application consists many no.of components working together.

    Component handles complete task, such as Business Logic, Database Transactions Logic and Presentation Logic.

    Disadvantages :

    1) Only One Application developer has to develop the complete component

    2) Application developer has to concentrate on Business Logic, Database Transactions Logic as well as PresentationLogic.

    3) Application Developer Must have the Multiple Skills

    4) Development Time is more

    5) Lot of confusion with Business Logic, Database Transactions Logic and Presentation Logic since they are beingdeveloped as single component.

    To overcome the above disadvantages MVC1 Architecture was introduced

    WEB

    CLIENT

    ApplicationComponents

    Servlet / JSP Data Base

  • 5/20/2018 OAF Basics

    2/84

    Raaj NagulapalliM.C.A

    2

    MVC1 Architecture :

    M Model V View C Controller

    Client Tier Application - Tier Database Tier

    HTTP Request

    HTTP Response

    Model : Model Represents data object. Model is what is being manipulated and presented to the user

    View : Serves as Screen representation of Model. It is the object that presents the current state of the data objects.

    Controller : Defines the way user interface reacts to the users input. The Controller component is the object thatmanipulates the model or data object.

    In MVC1 Architecture

    Servlet / JSP acts as View as well as Controller.

    Java Bean acts as Model Component.

    Disadvantages :

    1) Only One Application developer has to develop the component with Business Logic, as well as Presentation Logic.

    2) Application developer has to concentrate on Business Logic as well as Presentation Logic.

    3) Application Developer Must have the Multiple Skills

    4) Resources such as Java developers and Web developers can not be used effectively

    5) Development Time is more

    6) Lot of confusion with Business Logic, Presentation Logic since they are being developed as single component.

    To overcome the above disadvantages MVC2 Architecture has been introduced

    WEB

    CLIENT Data BaseJavaBean

    ApplicationComponents

    Servlet / JSP

  • 5/20/2018 OAF Basics

    3/84

    Raaj NagulapalliM.C.A

    3

    MVC2 Architecture :

    Struts Frame work follows the MVC2 Architecture

    Client Tier Application - Tier Database Tier

    HTTP Request

    HTTP Response

    Servlet acts as Controller

    JSP acts as View

    Java Bean acts as Model

    Controller:

    It is java Servlet called as Action Servlet. It receives request from the web client and stores data into the Java Beancalled as Form Bean (Model) and receives response (success / fail) from the Form Bean. Based on the response from FormBean, Action Servlet decides, which page (view) to be presented to the client.

    Model :

    It is Java Bean called as Form Bean. It will receive the client data through the Controller and performs the datavalidations or data base transactions such DML and DQL operations. After performing database transactions it provides thedata for the view.

    View :

    It is a JSP. It populates the data from the Form Bean ( Model ) and Present to the user.

    WEB

    CLIENT Data Base

    Controller

    Model

    View

  • 5/20/2018 OAF Basics

    4/84

    Raaj NagulapalliM.C.A

    4

    Oracle Application Frame Work Architecture :

    Architecture of Oracle Application Frame Work is similar to the Struts Frame Work but some difference are there.

    Client Tier Application - Tier Database Tier

    HTTP Request

    HTTP Response

    AM Application Module VO View Object EO Entity Object

    Controller :

    It is a Java Class. OAControllerImplis a parent of all Controller Classes. Controller performs data base transactions through the Application Module interface. It will get the data through the Application Module and Push into the View.

    View :

    It is JSP with GUI Components. It populates data of its GUI components through the Controller.

    View never Interact with the Model Component.Model :

    It is a combination of Application Module, View Object and Entity Object.

    Application Module :

    It is an interface given to the Controller Classes. It can be shared by multiple controllers. It performs DQL operations through the View Object It performs DML operations through the Entity Object. OAApplicationModuleImpl is a parent of Application Module Class.

    It is mandatory for all applications

    View Object :

    SQL Query ( SELECT statement to project the data in the form )

    It should be stored in .server package

    View Object can be developed manually or BC4j wizard

    OAViewObjectImpl :is the parent of all view objects

    All APIs starts with OA

    WEB

    CLIENT

    Model

    Data Base

    Controller1,2,3, 4 n

    View

    A

    M

    VO

    EO

  • 5/20/2018 OAF Basics

    5/84

    Raaj NagulapalliM.C.A

    5

    Entity Object :

    It is database object such as table, view and etc

    DML operations will be performed on the Entity Object

    It should be stored in schema.server package

    OAEntityImpl : is the parent of all Entity Objects

    Onion Architecture of OA Framework

    OA Framework can be extracted into a series of concentric layers, like an onion.

    Each layer communicates with it top and bottom layers.

    Compar

    ison of D2k , OAF and ADF

    D2k OAF ADF

    Stand Alone Application MVC Architecture MVC Architecture

    From Builder used to develop the

    applications

    JDeveloper is used to develop the

    applications

    JDeveloper is used to develop the

    applications

    PL/SQL JAVA JAVA

    Drag and Drop features No Drag and Drop features Drag and Drop features

    Desk Top Application Web Application Enterprise Applicaion

  • 5/20/2018 OAF Basics

    6/84

    Raaj NagulapalliM.C.A

    6

    JDeveloper Installation and Setting Environment

    1) Get the JDeveloper software ( ZIP File : p4141787_11i_GENERIC.zip )

    2) Copy into required drive ( folder ) / ( C:\)

    Eg: C:\ JDEV ( create JDEV ( name can be any one ) folder in C-drive

    3) Extract the ZIP file name p4141787_11i_GENERIC.zip )

    Right click WinZip ExtractToHere

    After extracting it generates following

    JDEV---- ( user created folder )

    |____ jdevbin

    |____ Jdevdoc

    |____ jdevhome

    4) Take the shortcut of C:\JDEV\jdevbin\jdev\bin\ jdevW.exe to desktop

    5) Copy the vis.dbc file form Oracle Apps Software to JDeveloper

    Source Oracle Apps path: D:\oracle\visappl\fnd\11.5.0\secure\VIS_apps\vis.dbc

    Destination JDevelopre Path: C:\JDEV\jdevhome\jdev\dbc_files\secure

    6) Set the Environment variables of O/S

    My Computer Advanced Environment Variables New

    Variable Name : JDEV_USER_HOME

    Variable Value : C:\JDEV\jdevhome\jdev

    OK OKOK

    Testing Functionality of Jdeveloper

    1) go to connection navigator Right ClickNew database connection Next

    Connection Name :test ( as desired )Connection Type :Oracle ( JDBC )

    Next :

    2) User Name : apps

    Password : apps

    Role : not necessary ( Roles such as site level, user level, application level )

    Next

  • 5/20/2018 OAF Basics

    7/84

    Raaj NagulapalliM.C.A

    7

    3) Driver : thin

    Host Name : localhost ( if database is on the current system else I.P Addres of DB server )

    JDBC Port : 1521

    SID : vis

    For details see the vis.dbc located in the folder :

    D:\oracle\visappl\fnd\11.5.0\secure\VIS_apps

    APPS_JDBC_URL=jdbc\:oracle\:thin\:@(DESCRIPTION\=(LOAD_BALANCE\=YES)(FAILOVER\=YES)(ADDR

    ESS_LIST\=(ADDRESS\=(PROTOCOL\=tcp)(HOST\=APPS.ora.com)(PORT\=1521)))(CONNECT_DATA\=(SID\

    VIS)))

    Next

    4) Test Connection

    Result : success

    Next

    5) Finish

    The packages, which are used in the OA Frame Work Applications.

    There are six package used in the OA Frame Work Applications.

    1) .oracle.apps...[]

    .webui

    2) .oracle.apps...[]

    lov.webui3) .oracle.apps...[]

    .server

    4) .oracle.apps...[]

    lov.server

    5) .oracle.apps...[]

    poplist.server

    6) .oracle.apps...[]

    Schema.server

    Steps to Develop the Application

    Eg:

    Hello Page

  • 5/20/2018 OAF Basics

    8/84

    Raaj NagulapalliM.C.A

    8

    1) Create the work space

    2) Create the project

    3) Create the package

    4) Create the application module

    5) Create the page

    6) Set the properties of the page

    AM Definition

    Window Title

    1) Creation of Work Space

    WorkSpace Right Click New OA work space

    File Name : First.jws ( jws Java Work Space )

    Directory Name : C:\JDEV\jdevbin\jdev\myprojects ( Browse for dir )

    SelectAdd a New OA Project

    2) Creation of a project

    Directory Name : C:\JDEV\jdevbin\jdev\myprojects

    Project name : First.jpr

    Package Name : first.oracle.apps.po.hello.webui

    Syntax : for Pack name

    .oracle.apps...[].webui

    In the above

    mnrao

    po

    welcomponent

    [] it is an optional ( as desired )

    Next

    Use Responsibility for design time ( select to test connection else not required )Supply the name of connection : test

    HereNew to create new connection

    Edit to change the name of the connection

    Next

    DBC File Name :C:\JDEV\jdevhome\jdev\dbc_files\secure\vis.dbc

    User name :operations ( front end user )

  • 5/20/2018 OAF Basics

    9/84

    Raaj NagulapalliM.C.A

    9

    Password :welcome

    Application short Name :PO

    Responsibility key : PURCHASING_OPERATIONS

    Next Finish

    3) Create of a package

    Right click on .jpr file New Business Component Package Next

    Package Name :first.oracle.apps.po.hello.server

    ( SelectEntity object mapped to database schema objects )

    Next

    Connection Name :test

    Sql Flavour :oracle

    Type Map :oracle

    Next

    User name : apps

    Password :apps

    Next finish

    Note :it generates test

    4) Create Application Module

    Right Click on package

    New Application Module

    Next

    Name : welcomeAM

    Package : first.oracle.apps.po.hello.server

    Next

    Next

    Next

    Next

    finish

    Note :It generates 1) TestAM.xml 2) TestAMImpl.java files

    5) Create of a Page

    Right Click on .jpr file New Web Tier OA Components Page OKName : HelloPG

    Package : first.oracle.apps.po.hello.webui

    Note :It generates HelloPG.xml file

    7) Set the Properties of the page

    Select the page Structure

  • 5/20/2018 OAF Basics

    10/84

    Raaj NagulapalliM.C.A

    10

    Region1

    Properties :

    Id : RootRN

    AM Definition :click on the box and select the AM

    Window Title :First Window

    Title : Hello This is my First Page

    ( at least one of the above two 1) Window Title 2) Title is required )

    8) Build the Application

    Right click on .jpr Re-build

    8) Run the Page

    Go to HelloPG.xml Right Click Run Page

    Working with items :

    Adding Items to region

    Before the creating items take a header region ( as desired )

    Naming Convention for Region :

    Name Starts with purpose

    Name ends with RN

    Right Click on Region1(RootRN)/ (HeaderRN) item

    Text Field :

    Properties :

    Id : UserId

    Item Style :messageTextInput

    Prompt :User Name

    Data Type :VARCHAR2 ( As desired )

    Comments :Created for Login User Id

    Required : Yes ( Yes Mandatory field, No Optional )

    Read only :True ( to Show it as read only filed, we can not edit the filed )False we can edit the filed.

    ( use for Id generating automatically , used with database sequence )

    Disable : true ( to avoid the cursor focus into the text filed )

    Maximum Length :the maximum no of Chars that can be entered into the text filed.

    Initial Value :default value

  • 5/20/2018 OAF Basics

    11/84

    Raaj NagulapalliM.C.A

    11

    Additional Text :text to be displayed when mouse over the item.

    Rendered :false to hide the text filed from the user.

    CSS Class :setting back ground colors.

    Length :Width of the text field, that can be visible to user

    Height :1 ( it will not generate multiple lines )> 1 to generated the multiple lines automatically

    Vertical Alignment :Top/Middle/Bottom ( Prompt alignment )

    Tip Type :to display some hint message just below the text filed

    Access Key :it is short cut key ( Alt + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 )

    Secret :True ( password ***** )

    To create next item click any item

    new

    item (or) right click on Region

    Submit Button :

    Id : Go

    Item Style: submitButton ( it will have default action)

    Prompt : Go

    resetButton :

    Id : Clear

    Item Style : resetButton( to clear the form)

    Text :Clear ( prompt )

    Access Key( Short Key )

    Normal Button

    Id : go

    Item Style :Button

    Prompt :as desired

    Action Type :fireAction ( like a trigger to get the action )

    It will be handled inside of controller class.

    Images :

    Copy the required Image into

    C:\JDEV\jdevhome\jdev\myhtml\OA_MEDIA

    Item Style :Image

    Image URI :( imagefile.gif)

    Additional Text :(Mouse over message)

    Link :

    Id : lnk

    Item Style :link

    Text :Oracle Apps Home

    Destination URI :http://apps.ora.com:8000

    http://apps.ora.com:8000/http://apps.ora.com:8000/
  • 5/20/2018 OAF Basics

    12/84

    Raaj NagulapalliM.C.A

    12

    To Connect to Gmail site use http://www.gmail.com

    Check Box :

    Id : job

    Item style :messageCheckBox

    Checked Value :MANAGER

    Unchecked Value :

    Initially Checked :true

    Initial Value : MANAGER

    The difference between Checkbox and Radio Button is that, Checkbox allows Multiple selection where

    as Radio Button

    allows Single Selection.

    Radio Buttons :

    First create RadiGroup

    Next create Radio Buttons

    Radio Group

    Id : gender

    Item style :messageRadioGroup

    Data Type :VARCHAR2

    Prompt :Gender

    Radio Button

    Id : male

    Item Style :messageRadioButtonGroup Name :gender

    Initial Vale :Male

    Value Checked :Male

    Prompt :MALE

    Spacer : to provide the space between two components

    Id : space

    Height / Width ( as desired )

    Raw Text :

    to display some text

    Id :

    Item Style :rawText

    Text : Oracle Apps Frame Work ( as desired )

    Separator :to place the separator between components ( line )

    Text Editor :

    http://www.gmail.com/http://www.gmail.com/
  • 5/20/2018 OAF Basics

    13/84

    Raaj NagulapalliM.C.A

    13

    Id : address

    Item Style :richTextEditor

    Vertical alignment :Top

    Maximum Length : 1000 ( as desired )

    Date :

    Id : hireDate

    Item Style :messageTextInput

    Data Type : DATE

    Prompt : Date Of Joining

    tipType : dateFormat

    TipMessage ( Hint Message ):First store message into the database table called: FND_NEW_MESSAGES

    with the help of Apps front end .

    Navigation :

    Application Developer Application Messages

    Name : NAME_TIPMSG ( copy and take into note pad )

    Language : US ,

    Application :Purchasing

    Current Message Text : as desired

    Save the above

  • 5/20/2018 OAF Basics

    14/84

    Raaj NagulapalliM.C.A

    14

    Set the properties of Item

    Eg :

    Id : name

    Item Style :messageTextInput

    Prompt : User Name

    Tip Type : shortTip [/ longMessage / none / dateFormat ]

    Tip Message Appl Short Name : PO

    Tip Message Name : NAME_TIPMSG

    Regions in the OAF

    Region is a area in the page.

    It holds list of Items

    Region is used to obtain desired layout in OA Frame Work

    Region follows embedded ( nested ) properties

    Default Layout of the Region isPageLayout

    It follows the java beans hierarchy

    The regions in the same node level are called as SIB

    LINGS .

    The regions inside the another region are called as SUB REGIONS or CHILD

    There are two types of regions 1) Internal Regions and 2) External Regions

    Different Styles of RegionRegion Style :

    Header

    Text :Oracle Frame Work ( as desired )

    defaultSingleColumn

    Right Justification

    defaultDoubleColumn

    to arrange the items in tow columns

    messageComponents

    to place the message components in the Rows and column

    components such as Text Items, ChechBoxes, Text Editor, Choice,

    RadioGroup, RadioButtons and etc

    Rows : 2Coulmns : 4

    ( here priority will be given to columns . Alignment is based on no.of Columns )

    Bulleted List

    text with bullets

    Eg: Oracle

    SQL and PL/SQL

    Apps Technical

  • 5/20/2018 OAF Basics

    15/84

    Raaj NagulapalliM.C.A

    15

    Apps DBA

    Oracle DBA

    hideShow

    to hide or show some fields ( arrow with some label )

    Disclosed Text : Hide User Details

    Un-Disclosed Text : Show User Details

    hideShowHeader without label ( only arrow symbol )

    PageButtonBar Region:

    To display the same components at the Top as well as Bottom of the page.

    Ex :

    HerePre and Next buttons ItemStyle is : submitButton

    rowLayout Region :

    To align the components in a Single Row with N No.of Colu

    mns

    Properties :

    Horizontal Alignment : Centre

    Vertical Alignment : Left

    Content Container Region :

    It is region with some background such as letter pads

    Properties :

    Background style : transparent, flexibleWidth : 75% or 30 % etc..

    CREATION OF LOV

    LOV can be created in two ways 1) Internal Region 2) External Region

    Internal Region is only for specific LOV item

    External Region is for rusability. It can be shared by multiple LOV items.

    Steps to create LOV with internal Region :

    1) Create item with itemStyle as messageLovInput

    2) Create the VO inside the package called lov.server and Shuffle VO to AM ( optional )

    3) Add VO to Item by using Wizard

    4) Set one of the item property search allowed : true

    5) Set the following LOV mapping

    Region item

    Return item

    Pre Next

    Pre Next

  • 5/20/2018 OAF Basics

    16/84

    Raaj NagulapalliM.C.A

    16

    Criteria item

    The LOV can be on the existing Page or New Page as per the requirement

    Eg:

    Creation of a page( like previous process )

    Right Click on Project file ( .jpr ) New Web Tier OA components Page OK

    Name : DemoLovItemPG ( as per naming conventions Page must end with PG)

    Package : test.oracle.apps.po.orgid.webui

    1) Create the item :

    Select theDemoLovItemPG.xml Region1

    Properties :

    AM Definition :

    Window Title :

    Title :Region1 ( RootRN) Rt.Click

    Create one more Region under the Region1 ( for purpo

    se of layout )

    Region2 :

    Id : Header

    Region Style : header

    Text : Enter Details

    Create item1 with Item Style as messageLovInput

    Region2 ( Header ) Rt.Click item

    Item properties :

    Id : organizationID

    Item Style : messageLovInput

    Prompt : organizationID

    When the item style set as messageLovInput, then following will be generated automatically under the item

    1) Region3

    2) lovMappings

    2) Create VO inside the lov.server package

    a)Create package : ( test.oracle.apps.po.orgid.lov.server )

    Get the already existing package name

    Double click on .jpr file and copy the package name ( test.oracle.apps.po.orgid.server )

    Right Click on .jpr New business Components Package Next

  • 5/20/2018 OAF Basics

    17/84

    Raaj NagulapalliM.C.A

    17

    Name of the package : ( paste the copied one test.oracle.apps.po.orgid.server and modify to

    test.oracle.apps.po.orgid.lov.server

    Next OKnext Finish

    b) Create New View Object

    Right Click on the package ( test.oracle.apps.po.orgid.lov.server ) New View Object

    Next

    View Name : OrganizationLovVO

    Package Name : test.oracle.apps.po.orgid.lov.server

    Next Next Next Next Next

    Query Statement :

    SELECT ORGANIZATION_ID, ORGANIZATION_NAME

    FROM ORG_ORGANIZATION_DEFINITIONS

    ;

    Test to test the query or it can be tested by usingTOAD tool (ok Query valid)

    Next Next Next Finish

    C) Shuttle VO to AM

    double click on AM Data Model test.oracle.apps.po.orgid.server

    organizationLovVO >> instance name : OrganizationLovVO

    Apply OK

    3) Add VO to LOV Item by using wizard

    Region3 ( region under the lov item ) Rt.ClickNew Table Using Wizard Next

    Application Module : test.oracle.apps.po.orgid.serverAvailable View usage

    select OrganizationLovVO

    Next

    Region ID : OrganizationTableRN

    Region Style : table

    Next Shuffle (OrganizationId and OrganizationName ) Next Next Finish

    4) Set one of item property

    OrganizationTableRN OrganizationId properties :Search Allow : true

    5) Set the following LOV mappings

    Region2 ( organiztionId ) lovMappings lovMap1 properties

    LovRegion Item : organiztionId ( value from the table Column )

    Return Item : organiztionId ( target field Value return to Item)

  • 5/20/2018 OAF Basics

    18/84

    Raaj NagulapalliM.C.A

    18

    Criteria Item : organiztionId ( search Item )

    Testing for Return Item

    create one more item with item style as messageTextInput

    Id: empName

    Prompt : empName

    Set the Return Item to empName

    Working with Controllers :

    Controller is a Java Class. It is used to capture the user actions, events also to perform business logic in the application .

    It controls the application flow

    It should be placed inside of the webui package

    Naming Convention is ends with CO

    Eg:

    Page Name : DemoPGController Name : DemoPGCO

    Package Name : test.oracle.apps.po.login.webui.webui

    Controller is only .Java file no other files

    The parent class for any controller is OAControllerImpl

    Controller provides following methods

    1) proceesRequest ( OAPageContext pageContext, OAWebBean webBean );

    2) proceesFromData ( OAPageContext pageContext, OAWebBean webBean );

    3) proceesFormRequest ( OAPageContext pageContext, OAWebBean webBean );

    processRequest ( OAPageContext pageContext, OAWebBean webBean );

    It will be executed before loading the page. It is used for initializations. Like a doGet() in Java or pre-form triggers in

    D2k application.

    processFormRequest ( OAPageContext pageContext, OAWebBean webBean );

    It will be executed after loading the page. Like a doPost() in Java or post-form triggers in D2k application.

    processFromData ( OAPageContext pageContext, OAWebBean webBean );

    This is used implement the business logic such validation, DML operations and etc.

    pageContext: is variable to read value, messages from the client and also used to call another page

    webBean : is a variable to send the response to the client and to control the bean properties dynamically

  • 5/20/2018 OAF Basics

    19/84

    Raaj NagulapalliM.C.A

    19

    Steps to create the controller :

    Create a New Page ( Login Page )

    Region1

    Properties :

    Id : RootRN

    Create sub region for the purpose of layout

    Create UserId, Password ( text fields ) and Submit and Cancel ( Buttons )

    Go to RootRN Set New Controller

    Package Name : mnrao.oracle.apps.po.firstcomp.webui.webui

    Class Name : LoginCO

    On creation of Controller it generates the .java file as shown below

    /*===========================================================================+

    | Copyright (c) 2001, 2003 Oracle Corporation, Redwood Shores, CA, USA |

    | All rights reserved. |

    +===========================================================================+

    | HISTORY |

    +===========================================================================*/

    package mnrao.oracle.apps.po.firstcomp.webui.webui;

    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;

    /**

    * Controller for ...

    */

    public class FirstCO extends OAControllerImpl

    {

    public static final String RCS_ID="$Header$";

    public static final boolean RCS_ID_RECORDED =

    VersionInfo.recordClassVersion(RCS_ID, "%packagename%");

    /**

    * Layout and page setup logic for a region.

    * @param pageContext the current OA page context

    * @param webBean the web bean corresponding to the region

  • 5/20/2018 OAF Basics

    20/84

    Raaj NagulapalliM.C.A

    20

    */

    public void processRequest(OAPageContext pageContext, OAWebBean webBean)

    {

    super.processRequest(pageContext, webBean);

    }

    /**

    * Procedure to handle form submissions for form elements in

    * a region.

    * @param pageContext the current OA page context

    * @param webBean the web bean corresponding to the region

    */

    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)

    {

    super.processFormRequest(pageContext, webBean);

    }

    }

    =========================================================================

    to test the order of execution write the following code in processRequest ()

    public void processRequest(OAPageContext pageContext, OAWebBean webBean)

    {

    super.processRequest(pageContext, webBean);System.out.println( " I am in Process Request Method ");

    }

    To test the order of execution write the following code in processFormRequest ()

    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)

    {

    super.processFormRequest(pageContext, webBean);System.out.println( " I am in Process Form Request Method ");

    }

    Right click on code editor Rebuild .java file

    If no errors then,

    Right click .XML file and run the page

  • 5/20/2018 OAF Basics

    21/84

    Raaj NagulapalliM.C.A

    21

    =========================================================================

    Capturing input values and Validation login details.

    /*===========================================================================+

    | Copyright (c) 2001, 2003 Oracle Corporation, Redwood Shores, CA, USA |

    | All rights reserved. |

    +===========================================================================+

    | HISTORY |

    +===========================================================================*/

    package demo.oracle.apps.po.choice.webui.webui;

    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.OAException;

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

    /**

    * Controller for ...

    */

    public class LoginCO extends OAControllerImpl

    {

    public static final String RCS_ID="$Header$";public static final boolean RCS_ID_RECORDED =

    VersionInfo.recordClassVersion(RCS_ID, "%packagename%");

    /** * Layout and page setup logic for a region.

    * @param pageContext the current OA page context

    * @param webBean the web bean corresponding to the region

    */

    public void processRequest(OAPageContext pageContext, OAWebBean webBean)

    {

    super.processRequest(pageContext, webBean);}

    /** Procedure to handle form submissions for form elements in a region.

    * @param pageContext the current OA page context

    * @param webBean the web bean corresponding to the region

    */

    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)

  • 5/20/2018 OAF Basics

    22/84

    Raaj NagulapalliM.C.A

    22

    {

    super.processFormRequest(pageContext, webBean);

    if( pageContext.getParameter("submit")!=null)

    {

    String lstrUid = pageContext.getParameter("uid");

    String lstrPwd = pageContext.getParameter("pwd");

    if( lstrUid.equalsIgnoreCase("OPERATIONS")&& lstrPwd.equalsIgnoreCase("WELCOME"))

    {

    throw new OAException( "Valid User", OAException.CONFIRMATION);

    }

    else

    {

    throw new OAException( "InValid User", OAException.ERROR);

    }

    }// end of if checking for submit

    if( pageContext.getParameter("clear")!=null)

    {

    OAMessageTextInputBean uidBean = ( OAMessageTextInputBean ) webBean.findChildRecursive("uid");

    uidBean.setValue(pageContext, null );

    OAMessageTextInputBean pwdBean =( OAMessageTextInputBean ) webBean.findChildRecursive("pwd");

    pwdBean.setValue(pageContext,null );

    } //end of if checking for clear.

    } // end of processFormRequest method

    } // end of Class LoginCO.java

    To find the location of Class Name

    Help

    Go to C:\JDEV\jdevdoc \ index.html

    OA Framework v. 11.5.10

    Find ( ctrl + f ) type the Class Name .

    List Of Values ( LOV )

    LOV can be created in two ways 1) Internal Region 2) External Region

    Internal Region is only for specific LOV item

  • 5/20/2018 OAF Basics

    23/84

    Raaj NagulapalliM.C.A

    23

    External Region is for reusability. It can be shared by multiple LOV items.

    Steps to create LOV with internal Region :

    6) Create item with itemStyle as messageLovInput

    7) Create the VO inside the package called lov.server and Shuffle VO to AM ( optional )

    8) Add VO to Item by using Wizard

    9) Set one of the item property search allowed : true

    10) Set the following LOV mapping

    Region item

    Return item

    Criteria item

    The LOV can be on the existing Page or New Page as per the requirement

    Eg:

    Creation of a page( like previous process )

    Right Click on Project file ( .jpr ) New Web Tier OA components Page OK

    Name : DemoLovItemPG ( as per naming conventions Page must end with PG)

    Package : test.oracle.apps.po.orgid.webui

    1) Create the item :

    Select theDemoLovItemPG.xml Region1

    Properties :AM Definition :

    Window Title :

    Title :

    Region1 ( RootRN) Rt.Click

    Create one more Region under the Region1 ( for purpose of layout )

    Region2 :

    Id : Header

    Region Style : headerText : Enter Details

    Create item1 with Item Style as messageLovInput

    Region2 ( Header ) Rt.Click item

    Item properties :

    Id : organizationID

    Item Style : messageLovInput

  • 5/20/2018 OAF Basics

    24/84

    Raaj NagulapalliM.C.A

    24

    Prompt : organizationID

    When the item style set as messageLovInput, then following will be generated automatically under the item

    3) Region3

    4) lovMappings

    3) lovMap1

    2) Create VO inside the lov.server package

    a)Create package : ( test.oracle.apps.po.orgid.lov.server )

    Get the already existing package name

    Double click on .jpr file and copy the package name ( test.oracle.apps.po.orgid.server )

    Right Click on .jpr New business Components Package Next

    Name of the package : ( paste the copied one test.oracle.apps.po.orgid.server an

    d modify to

    test.oracle.apps.po.orgid.lov.server

    Next OKnext Finish

    b) Create New View Object

    Right Click on the package ( test.oracle.apps.po.orgid.lov.server ) New View Object

    Next

    View Name : OrganizationLovVO

    Package Name : test.oracle.apps.po.orgid.lov.server

    Next Next Next Next Next

    Query Statement :SELECT ORGANIZATION_ID, ORGANIZATION_NAME

    FROM ORG_ORGANIZATION_DEFINITIONS ;

    Test to test the query or it can be tested by usingTOAD tool (ok Query valid)

    Next Next Next Finish

    C) shuttle VO to AM

    double click on AM Data Model test.oracle.apps.po.orgid.server

    organizationLovVO >> instance name : OrganizationLovVO

    Apply OK

    3) Add VO to LOV Item by using wizard

    Region3 ( region under the lov item ) Rt.ClickNew Table Using Wizard Next

    Application Module : test.oracle.apps.po.orgid.server

    Available View usage

    select OrganizationLovVO

  • 5/20/2018 OAF Basics

    25/84

    Raaj NagulapalliM.C.A

    25

    Next

    Region ID : OrganizationTableRN

    Region Style : table

    Next Shuffle (OrganizationId and OrganizationName ) Next Next Finish

    4) Set one of item property

    OrganizationTableRN OrganizationId properties :

    Search Allow : true

    5) set the following LOV mappings

    Region2 ( organiztionId ) lovMappings lovMap1 properties

    LovRegion Item : organiztionId ( value from the table Column )

    Return Item : organiztionId ( target field Value return to Item)

    Criteria Item : organiztionId ( search Item )

    Testing for Return Item

    create one more item with item style as messageTextInput

    Id: empName

    Prompt : empName

    Set the Return Item to empName

    Steps to create LOV with External Region :

    1) Create item with itemStyle as messageLovInput

    2) Create the VO inside the package called lov.server and shuttle to AM3) Create External Region

    Name : as desired

    Style : listofvalues

    Package : < > . .webui

    4) Set the following two properties to External Region

    Scope : public

    AM Definition : AM

    5) Add VO to external Region by using Wizard and set one of the item property

    search allowed : true

    6) Add external region corresponding LOV input bean item by using external property

    7) Set the following LOV mapping

    Region item

    Return item

    Criteria item

  • 5/20/2018 OAF Basics

    26/84

    Raaj NagulapalliM.C.A

    26

    Note :The steps 3, 4 and 5 are extra steps with external region.

    Creation of a page ( like previous process )

    Right Click on Project file ( .jpr ) New Web Tier OA components Page OK

    Name : DemoLovItemPG ( as per naming conventions Page must end with PG)

    Package : test.oracle.apps.po.supp.webui

    1) Create the item :

    Select theDemoLovItemPG.xml Region1

    Properties :

    AM Definition :

    Window Title :

    Title :

    Create one more Region under the Region1 ( for purpose of layout )

    Region1 Rt.Click

    Region2 :

    Id :

    Region Style : header

    Text : Enter Details

    Create item1 with Item Style as messageLo

    vInput

    Region2 Rt.Click item

    Item properties :

    Id : SupplierID

    Item Style : messageLovInputPrompt : SupplierID

    When the item style set as messageLovInput, then following will be generated automatically under the item

    1) Region3

    2) lovMappings

    3) Lov Map

    2) Create VO inside the lov.server package and shuttle VO to AM

    a)Create package : (test.oracle.apps.po.supp.lov.server )

    Note : if package is already available then need not to create

    Get the already existing package name

    Double click on .jpr file and copy the package name (test.oracle.apps.po.supp.server )

    Right Click on .jpr New business Components Package Next

  • 5/20/2018 OAF Basics

    27/84

    Raaj NagulapalliM.C.A

    27

    Name of the package : ( paste the copied one test.oracle.apps.po.supp.server and modify to

    test.oracle.apps.po.supp.lov.server

    Next OKnext Finish

    b) Create New View Object

    Right Click on the package (test.oracle.apps.po.supp.lov.server ) New View Object

    Next

    View Name : SuppDetailsLovVO

    Package Name : test.oracle.apps.po.supp.lov.server

    Next Next Next Next

    Query Statement :

    select vendor_id, vendor_name, creation_date from po_vendors

    Test to test the query or it can be tested by usingTOAD tool (o

    k Query valid)

    Next Next Next Finish

    Shuttle VO to AM

    double click on SuppDetailsAM Data Model test.oracle.apps.po.supp.lov.server

    SuppDetailsVO >> instance name : SuppDetailsVO

    Apply OK

    3) Create external region

    Rt.Click on .jpr

    New

    OA Component

    Region

    OKName : SuppDetailsLovRN

    Pack : test.oracle.apps.po.supp.webui

    Style : ListOfValues

    OK

    The above generates SuppDetailsLOVRN.xml file

    4) Set the following two properties to External Region

    SelectSuppDetailsLOVRN.xml fileand go to structureSelect the

    Scope : public

    AM Definition : test\oracle\apps\po\supp\server\SuppDetailsAM

    5) Add VO to external region by using wizard and set one of the item property search allow true

  • 5/20/2018 OAF Basics

    28/84

    Raaj NagulapalliM.C.A

    28

    SelectSuppDetailsLOVRN.xmland go to structure Rt.click

    New Table Using Wizard Next

    Application Module : test.oracle.apps.po.supp.server.SuppDetailsAM

    ( the AM Which is available in .server package )

    Available View Usage : SuppDetailsLovVO

    Next

    Region Id : SuppDetailsTableVO

    Region style : table

    Next shuttle all attributes or required attributes as desired

    Next Finish

    set one of the item property search allow true

    SuppDetailsLovRN

    Vendor Id search allow true

    Vendor Name

    search allow true

    6) Add external region to corresponding LOV input item by using external property

    Go to lov item (SupplierID )

    Property :

    External Lov : /test/oracle/apps/po/supp/lov ( browse to lov )

    Search

    ( select required external region )

    OK

    Yes

    7) Set the following LOV mapping

    Region item

    Return item

    Criteria item

    Region2( header under the main region) SupplierID lovMappings lovMap1 properties

    LovRegion Item : VendorId ( column name in the table )

    Return Item : SupplierID ( Returning to field in the page )Criteria Item : SupplierID

    Region Style as Query

    Query Region Style is used to develop the search page.

    A search page can be developed in two ways

    1) Using Query Region Wizard 2) Manually

  • 5/20/2018 OAF Basics

    29/84

    Raaj NagulapalliM.C.A

    29

    1) Using Query Region Wizard

    Steps to develop the search page

    1) Create the Region with region style as Query

    2) Develop the VO and Shuttle to AM

    3) Add VO to Query Region by using wizard

    4) Set the following properties

    Construction Mode : requestBasedSearch

    Include Single Panel : true

    Include views panel : true

    Advanced Panel : true

    1) Create a New Page for testing :

    Go to RootRN and create new region with region style as Query( id :Quer

    yRN: as desired )

    2) Develop the VO ( eg: Name : EmpVO ) and Shuttle to AM

    Rt.Click on .server package and create VO

    Query :

    SELECT employee_id, title, full_name, email_address, position_code, salary, start_date, end_date

    FROM FWK_TBX_EMPLOYEES

    Shuttle VO to AM

    3) Add VO to Query Region by using wizard

    Go to QueryRN New Region Using Wizard

    Application Module : test.oracle.apps.po.query.server.TestAmAvailable View Usage : EmpVO select next

    Region Id : EmpQueryDetailsRN

    RegionStyle : table next select the Style as messageStyleTest ( to make the fields as read only )

    Next finish

    Go to EmpQueryDetailsRN set the item Style of the attributes as messageStyledText to set the attributes as read only

    Set the property of EmpQueryDetailsRN

    Records Displayed : 6 ( as desired )

    4) Set the following properties on QueryRN

    Construction Mode : resultBasedSearch Include Simple : True

    Include Views Panel : True

    Include Advanced Panel : True

    To search based on particular field go to EmpQueryDetailsTableRN and set the required Attribute assearch allow true

    HereEmployeeId and Title are set assearch allow true.Hence the following form showing with

  • 5/20/2018 OAF Basics

    30/84

    Raaj NagulapalliM.C.A

    30

    EmployeeId :

    Title :

    Type the values and select Go

    Advanced search is based on some conditions

  • 5/20/2018 OAF Basics

    31/84

    Raaj NagulapalliM.C.A

    31

    Working with switcher region :

    1) Modify the Query in the VO

    Go to EmpVO and Double click on it select Query and modify to

    SELECT employee_id, title, full_name, email_address, position_code, salary, start_date, end_date,

    decode(end_date, NULL, 'Delete_Disabled', 'Delete_Enabled') deleteswitcher

    FROM FWK_TBX_EMPLOYEES Alias_name

    2) Go to EmpQueryDetailsTableRN New Switcher Region -->

    Id : SwitcherRN

    Rt.Click onSwitcherRN Rt.Click case

    Go to first case

    Rt.Click

    item

    Id: Delete_Disabled

    Itemstyle : image

    Image URI : deleteicon_disabled.gif

    Go to second case Rt.Click item

    Id : Delete_Enabled

    Itemstyle : image

    Image URI : deleteicon_enabled.gif

    Set the properties onSwitcherRN

    View Instance : EmpVO

    View instance Name : deleteswitcher

    Prepared Statement

    It is a pre-compiled statement at the database server. This statement is used to improve the performance of theapplication.

  • 5/20/2018 OAF Basics

    32/84

    Raaj NagulapalliM.C.A

    32

    Steps to write thePrepared Statement

    1) Get the connection reference from the database

    Connection con= this.getOADBTransaction().getJdbcConnection(); ( inside of xxxxAmImpl.java)

    // this refer to xxxxAmImpl instance

    2) Write the prepared statement

    PreparedStatement pst= con.prepareStatement("INSERT INTO STUDENT VALUES ( ? ,? , ?)");

    ? is a place holder . it will referred with index 1, 2, 3

    3) Set the values on the place holder

    Eg: pst.setInt(1, 1001);

    pst.setString(2, Chandra);

    pst.setInt(3, 25);

    4) Execute the Query

    int num = pst.execute();(or)

    int num = pst.executeUpdate();

    the above returns no.of records INSERTED / DELETED / UPDATED in the database.

    5) Commit the transaction

    con.commit();

    Example :

    Inserting records into database

  • 5/20/2018 OAF Basics

    33/84

    Raaj NagulapalliM.C.A

    33

    Here submit

    to insert record into database

    Clear

    to clear the form

    xxxCO.Java coding

    /*==================================

    =========================================+| Copyright (c) 2001, 2003 Oracle Corporation, Redwood Shores, CA, USA || All rights reserved. |+===========================================================================+| HISTORY |+===========================================================================*/

    package aa.oracle.apps.po.aa.webui;

    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 aa.oracle.apps.po.aa.server.AaaAMImpl;import oracle.apps.fnd.framework.OAException;

    /*** Controller for ...

    */public class StudentInsertCO extends OAControllerImpl{public static final String RCS_ID="$Header$";public static final boolean RCS_ID_RECORDED =

    VersionInfo.recordClassVersion(RCS_ID, "%packagename%");

    /*** Layout and page setup logic for a region.* @param pageContext the current OA page context

  • 5/20/2018 OAF Basics

    34/84

    Raaj NagulapalliM.C.A

    34

    * @param webBean the web bean corresponding to the region*/

    public void processRequest(OAPageContext pageContext, OAWebBean webBean){

    super.processRequest(pageContext, webBean);}

    /**

    * Procedure to handle form submissions for form elements in* a region.* @param pageContext the current OA page context* @param webBean the web bean corresponding to the region*/

    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean){

    super.processFormRequest(pageContext, webBean);

    if ( pageContext.getParameter("Submit")!=null){

    int sno = Integer.parseInt(pageContext.getParameter("Rno"));

    String sname = pageContext.getParameter("Sname");

    int sage = Integer.parseInt(pageContext.getParameter("Age"));

    AaaAMImpl am = ( AaaAMImpl ) pageContext.getApplicationModule(webBean);

    int ret = am.insertRecord(sno, sname, sage);

    if(ret==0){

    throw new OAException(" Record Succussfully Inserted", OAException.CONFIRMATION);}else if(ret==1){

    throw new OAException("Sql Exception", OAException.ERROR);

    }else{

    throw new OAException("Unkwon Error", OAException.ERROR);}

    }

    }

    }

    xxxAMImpl.java coding

    package aa.oracle.apps.po.aa.server;

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

    import oracle.jbo.server.ApplicationModuleImpl;

    import aa.oracle.apps.po.aa.lov.server.SuppDetailsVOImpl;

    import java.sql.PreparedStatement;

    import java.sql.SQLException;

    import java.sql.Connection;

  • 5/20/2018 OAF Basics

    35/84

    Raaj NagulapalliM.C.A

    35

    // ---------------------------------------------------------------// --- File generated by Oracle Business Components for Java.// ---------------------------------------------------------------

    public class AaaAMImpl extends OAApplicationModuleImpl{

    /***

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

    /**** Sample main for debugging Business Components code using the tester.*/

    public static void main(String[] args){

    launchTester("aa.oracle.apps.po.aa.server", "AaaAMLocal");}

    /**** Container's getter for SuppDetailsVO*/

    public SuppDetailsVOImpl getSuppDetailsVO(){

    return (SuppDetailsVOImpl)findViewObject("SuppDetailsVO");

    }

    // user defined method to insert the records into databasepublic int insertRecord(int lSno, String lSname, int lAge ){

    PreparedStatement pst=null;

    Connection con=null;

    try

    {con=this.getOADBTransaction().getJdbcConnection();

    pst= con.prepareStatement("INSERT INTO STUDENT VALUES ( ? ,? , ?)");

    System.out.println(lSno+"\n"+lSname+"\n"+lAge);

    pst.setInt(1,lSno);

    pst.setString(2,lSname);

    pst.setInt(3,lAge);

    //pst.executeUpdate();

  • 5/20/2018 OAF Basics

    36/84

    Raaj NagulapalliM.C.A

    36

    pst.execute();

    // System.out.println("Success");

    con.commit();

    return 0;

    }catch(SQLException e)

    { return 1;}catch( Exception e ){

    return 2;}finally{

    try{

    pst.close();}catch(SQLException e){

    return 1;}

    }} // end of insertRecord Method

    } // end of class

    Getting result form the prepared statement.

    PreparedStatement pst = con.prepareStatement( SELECT * FROM STUDENT WHERE ROLLNO=?);

    pst.setInt(1,1001);

    pst.execute();

    In the above statement result set will be stored into the prepared statement

    ResultSet rs = pst.getResultSet();

    int rollno = rs.getInt(1);String name = rs.getString(2);

    int age = rs.getInt(3);

    Callable Statement :

    Callable Statementis an interface from java.sql packageIt is used to execute the stored procedure

  • 5/20/2018 OAF Basics

    37/84

    Raaj NagulapalliM.C.A

    37

    Stored Procedure :

    It is a set statements at the database server. It contains statements such as SELECT, INSERT, DELETE, UPDATE and alsostatements to perform validations

    It carries three types of parameters

    1) in to pass the value

    2) out

    to return the value3) in-out to pass as well as to return the value

    Advantages in using stored procedure :

    1) It improves the performance of the application2) Since Stored Procedure is storing at the database server it can be shared by multiple clients.

    Steps to prepare the callable statement

    1) Get the connection reference from the database

    Connection con=this.getOADBTransaction().getJdbcConnection(); ( xxxxAmImpl.java)// this means xxxxAmImpl instance

    2) prepare the callable statement

    CallableStatement cst = con.prepareCall( { CALL sp_test ( ? , ? , ? , .. )};CALL is key word to call the stored procedure at the database server.

    3) Register the parameters

    1) in parameters : these are default parameter. Hence it is an optional to register directly value can be passed

    Eg.cst.setInt(1, 1001)cst.setString(2, hello);

    2) out parameters :

    cst.registerOutParameter(3, Types.VARCHAR)

    Once the parameter registered as out parameter, then value can not be passed.

    setX() should not be used after registering as out parameter. It throws SQLException.

    3) in-out parameter :

    cst.registerInOutParameter(4, Types.INT);

    cst.setInt(4,2007);

    4) Execute the Callable statement

    cst.execute();

    5) Read the out parameters

  • 5/20/2018 OAF Basics

    38/84

    Raaj NagulapalliM.C.A

    38

    String str = cst.getString(3)

    int num = cst.getInt(4);

    Types:

    It is an interface from java.sql package.

    It provides the constants to map with the database data types.

    Types.BIT Types.BOOLEAN Types.SMALLINT Types.TINYINT

    Types.INTEGER Types.BIGINT Types.NUMERIC Types.DECIMAL;

    Types.FLOAT Types.REAL Types.DOUBLE Types.CHAR

    Types.VARCHAR Types.LONGVARCHAR Types.TIME Types.TIMESTAMP

    Types.DATE Types.BLOB Types.CLOB Types.VARBINARY

    Types.BINARY

    Example :

  • 5/20/2018 OAF Basics

    39/84

    Raaj NagulapalliM.C.A

    39

    Sample procedure to insert records into database and get status back

    CREATE OR REPLACE PROCEDURE STUDENT_PROC ( ROLLNO NUMBER, NAME VARCHAR2, AGE NUMBER,retCode OUT NUMBER )ISBEGIN

    INSERT INTO STUDENT VALUES ( ROLLNO, NAME, AGE);COMMIT;retCode :=0;

    EXCEPTION

    WHEN OTHERS THENretCode:=1;

    END;/

    xxAMImpl.java coding

  • 5/20/2018 OAF Basics

    40/84

    Raaj NagulapalliM.C.A

    40

    package aa.oracle.apps.po.aa.server;

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

    import oracle.jbo.server.ApplicationModuleImpl;

    import aa.oracle.apps.po.aa.lov.server.SuppDetailsVOImpl;

    import java.sql.CallableStatement;

    import java.sql.SQLException;

    import java.sql.Connection;

    import java.sql.Types;

    // ---------------------------------------------------------------// --- File generated by Oracle Business Components for Java.// ---------------------------------------------------------------

    public class AaaAMImpl extends OAApplicationModuleImpl{

    /**** This is the default constructor (do not remove)*/

    public AaaAMImpl(){}

    /**** Sample main for debugging Business Components code using the tester.*/

    public static void main(String[] args)

    {launchTester("aa.oracle.apps.po.aa.server", "AaaAMLocal");

    }

    /**** Container's getter for SuppDetailsVO*/

    public SuppDetailsVOImpl getSuppDetailsVO(){

    return (SuppDetailsVOImpl)findViewObject("SuppDetailsVO");}

    // User defined method to execute the stored procedure

    public int insertRecord(int lSno, String lSname, int lAge ){

    Connection con=null;CallableStatement cst=null;

  • 5/20/2018 OAF Basics

    41/84

    Raaj NagulapalliM.C.A

    41

    try{

    con=this.getOADBTransaction().getJdbcConnection();

    cst= con.prepareCall("{CALL STUDENT_PROC( ? , ? , ? , ?) }");

    cst.setInt(1,lSno);

    cst.setString(2,lSname);

    cst.setInt(3,lAge);

    cst.registerOutParameter(4,Types.NUMERIC);

    cst.execute();

    int retCode = cst.getInt(4);

    return retCode;}catch(SQLException e){

    return 1;}catch( Exception e ){

    return 2;}finally{

    try{cst.close();}catch(SQLException e)

    { return 1;}

    }}

    }

  • 5/20/2018 OAF Basics

    42/84

    Raaj NagulapalliM.C.A

    42

    xxCO.Java coding

    /*===========================================================================+| Copyright (c) 2001, 2003 Oracle Corporation, Redwood Shores, CA, USA || All rights reserved. |+===========================================================================+| HISTORY |

    +===========================================================================*/

    package aa.oracle.apps.po.aa.webui;

    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 aa.oracle.apps.po.aa.server.AaaAMImpl;

    import oracle.apps.fnd.framework.OAException;

    /*** Controller for ...*/

    public class StudentInsertCO extends OAControllerImpl{public static final String RCS_ID="$Header$";public static final boolean RCS_ID_RECORDED =

    VersionInfo.recordClassVersion(RCS_ID, "%pac

    kagename%");

    /*** Layout and page setup logic for a region.

    * @param pageContext the current OA page context* @param webBean the web bean corresponding to the region*/

    public void processRequest(OAPageContext pageContext, OAWebBean webBean){

    super.processRequest(pageContext, webBean);}

    /*** Procedure to handle form submissions for form elements in* a region.* @param pageContext the current OA page context* @param webBean the web bean corresponding to the region*/

    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean){

    super.processFormRequest(pageContext, webBean);

  • 5/20/2018 OAF Basics

    43/84

    Raaj NagulapalliM.C.A

    43

    if ( pageContext.getParameter("Submit")!=null){

    int sno = Integer.parseInt(pageContext.getParameter("Rno"));

    String sname = pageContext.getParameter("Sname");

    int sage = Integer.parseInt(pageContext.getParameter("Age"));

    AaaAMImpl am = ( AaaAMImpl ) pageContext.getApplicationModule(webBean);

    int ret = am.insertRecord(sno,sname,sage);

    if(ret==0){

    throw new OAException(" Record Succussfully Inserted", OAException.CONFIRMATION);}else if(ret==1){

    throw new OAException("Sql Exception", OAException.ERROR);}else{

    throw new OAException("Unkwon Error", OAException.ERROR);}

    } // end of if checking for submit button

    } // end of processFormRequest method.

    } // end of class.

    Search based on where clause parameters

  • 5/20/2018 OAF Basics

    44/84

    Raaj NagulapalliM.C.A

    44

    In the above search should be done in the following ways

    1) if all fields null, then displaying all records

    2) if Supplier Nameis entered, then based on Supplier Name

    3) if Supplier Typeis entered, then based on Supplier Type

    4) ifSupplier Number entered, then based on Supplier Number

    5) if all are entered, then based on all.

    1) Create SupplierSearchPG

    Properties

    Id : RootRN

    Window Title : SearchWindow

    Title : Supplier SearchCreate header Region for layout designing

    Properties :

    Id : Header

    Text : Search By

    Create a Region ( SupplierDetailsRN ) to holdSupplierName, SupplierType and SupplierNumber

    Region Style asmessageComponentLayout

  • 5/20/2018 OAF Basics

    45/84

    Raaj NagulapalliM.C.A

    45

    Rows : 2

    Columns : 2

    UnderSupplierDetailsRN,

    Create 1) messageTextInput field for SupplierName

    2)messageLovInput field for SupplierType

    3) messageLovInput field for SupplierNumber

    Create Region ( ButtonRN ) for the Buttons ( Submit and Clear ) with properties

    region style :rowlayout

    Horizontal Alignment : centre

    AddGo and Clearwith itemStyle assubmitButton

    2) Create VO for SupplierType and SupplierNumber and suttle to AM

    Create SupplierSearchAM inside of test.oracle.apps.po.supp.lov.server

    CreateSupplierType VO under .lov.server package

    Query :

    select pv.VENDOR_TYPE_LOOKUP_CODE "Vendor Type" from po_vendors pv

    CreateSupplierNumber VO under .lov.server package

    Select pv.SEGMENT1 "Vendor Number" from po_vendors pv

    suttle both to AM

    3) create external regions forSupplierType and SupplierNumber

    CreateSupplierType Region under .webui package

    Name :SupplierTypeLovRNPackage :test.oracle.apps.po.supp.webui

    Style :listOfValues

    Scope : public

    AM definition : test.oracle.apps.po.supp.lov.server.SupplierSearchAM

    Go to SupplierTypeLovRN new table Using Wizard

    Application Module : test.oracle.apps.po.supp.lov.server.SupplierSearchAM

    Available View Usage : SupplierTypeVO

    Regiod Id : SupplierTypeTableRN

    Region Style : tableSearch Allow : True for SupplierType

    CreateSupplierNumber Region under .webui package

    Name :SupplierNumberLovRN

    Package :test.oracle.apps.po.supp.webui

    Style :listOfValues

    Scope : public

  • 5/20/2018 OAF Basics

    46/84

    Raaj NagulapalliM.C.A

    46

    AM definition : test.oracle.apps.po.supp.lov.server.SupplierSearchAM

    Go to SupplierNumberLovRN new table Using Wizard

    Application Module : test.oracle.apps.po.supp.lov.server.SupplierSearchAM

    Available View Usage : SupplierNumberVO

    Regiod Id : SupplierNumberTableRN

    Region Style : table

    Search Allow : True for SupplierNum

    4) Add the above external regions to SupplierType and SupplierNumber

    Add toSupplierType

    Go to SupplierType item in the Page

    Properties

    External Lov : /test/oracle/apps/po/supp/webui/SupplierTypeLovRN

    Lov Mappings

    Lov Region Item : VendorType

    Return Item : SupplierType

    Criteria Item : SupplierType

    Add toSupplierNumber

    Go to SupplierNumber item in the page

    Properties :External Lov : /test/oracle/apps/po/supp/webui/SupplierNumberLovRN

    Lov Mappings

    Lov Region Item : VendorNumber

    Return Item : SupplierNumber

    Criteria Item : SupplierNumber

    5) Create Region ( SiteDetailsRN ) for site details with Region Style as Advanced Table

    6) Create VO for SiteDetailsRN inside the .server package.

    Query :select pv.VENDOR_NAME Supplier Name",

    pv.SEGMENT1 "Supplier Number",

    pvsa.VENDOR_SITE_CODE "Supplier Site",

    pv.VENDOR_TYPE_LOOKUP_CODE "Supplier Type",

    pvsa.COUNTRY "Country Code"

  • 5/20/2018 OAF Basics

    47/84

    Raaj NagulapalliM.C.A

    47

    from

    po_vendors pv,

    po_vendor_sites_all pvsa

    where

    pv.VENDOR_ID = pvsa.VENDOR_ID

    and pv.VENDOR_NAME like nvl(:1, pv.VENDOR_NAME)

    and pv.VENDOR_TYPE_LOOKUP_CODE like nvl(:2, pv.VENDOR_TYPE_LOOKUP_CODE)

    and pv.SEGMENT1 like nvl(:3, pv.SEGMENT1)

    Shuffle the above VO to AM ( AM inside the server package : DemoAM)

    7) Go to SupplierSerachPG

    Go to SiteTableRN

    Properties :

    View Instance : SiteDetailsTableVO

    Create the Columns for the Site Details

    Supplier Name Supplier Number Supplier Site Supplier Type Country Code

    1) Supplier Name

    SiteTableRN New Column

    Properties :

    Column Id :Column1Create Item under the Column (SuppName )

    Id : SuppName

    Item Style :messageStyleText

    View Attribute :SupplierName

    ColumnHeaderNew sortableHeader

    Properties :

    Prompt :Supplier Name

    2)Supplier Number

    SiteTableRN New ColumnProperties :

    Column Id :Column2

    Create Item under the Column (SuppNum )

    Id : SuppNum

    Item Style :messageStyleText

    View Attribute :SupplierName

  • 5/20/2018 OAF Basics

    48/84

    Raaj NagulapalliM.C.A

    48

    ColumnHeaderNew sortableHeader

    Properties :

    Prompt :Supplier Number

    3) Supplier Site

    SiteTableRN New Column

    Properties :

    Column Id :SuppSite

    Create Item under the Column (SuppSite )

    Id : SuppSite1

    Item Style :messageStyleText

    View Attribute :SupplierSite

    ColumnHeaderNew sortableHeader

    Properties :

    Prompt :Supplier Site

    4) Supplier Type

    SiteTableRN New Column

    Properties :

    Column Id :Column4

    Create Item under the Column (SuppType)

    Id : SuppType1

    Item Style :messageStyleText

    View Attribute :SupplierTypeColumnHeaderNew sortableHeader

    Properties :

    Prompt :Supplier Type

    5) Country Code

    SiteTableRN New Column

    Properties :

    Column Id :Column5

    Create Item under the Column (Country)

    Id : Country

    Item Style :messageStyleText

    View Attribute : CountryCode

    ColumnHeaderNew sortableHeader

    Properties :

    Prompt : Country Code

  • 5/20/2018 OAF Basics

    49/84

    Raaj NagulapalliM.C.A

    49

    Page design is as shown below

    8) Create Controller on the Page under the package .webui

    Class Name : SupplierSearchCO

    Write the following code :

    The code, which is added to existing one is being highlighted with Bold and Big font

    /*===========================================================================+

    | Copyright (c) 2001, 2003 Oracle Corporation, Redwood Shores, CA, USA || All rights reserved. |

    +===========================================================================+

    | HISTORY |

    +===========================================================================*/

    package ge.oracle.apps.po.supp.server.webui;

    import oracle.apps.fnd.common.VersionInfo;

    SupplierNumer & SupplierType

    ( LOV Item )

    AdvancedTable Region

    Column

    Items with messageStyledText

    Sortable Header ( Column Names )

  • 5/20/2018 OAF Basics

    50/84

    Raaj NagulapalliM.C.A

    50

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

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

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

    // newly added package

    import ge.oracle.apps.po.supp.server.SupplierAMImpl;

    /**

    * Controller for ...

    */

    public class SupplierSearchCO extends OAControllerImpl

    {

    public static final String RCS_ID="$Header$";

    public static final boolean RCS_ID_RECORDED =

    VersionInfo.recordClassVersion(RCS_ID, "%packagename%");

    /**

    * Layout and page setup logic for a region.

    * @param pageContext the current OA page context

    * @param webBean the web bean corresponding to the region

    */

    public void processRequest(OAPageContext pageContext, OAWebBean webBean)

    {

    super.processRequest(pageContext, webBean);

    }

    /**

    * Procedure to handle form submissions for form elements in* a region.

    * @param pageContext the current OA page context

    * @param webBean the web bean corresponding to the region

    */

    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)

    {

    super.processFormRequest(pageContext, webBean);

    //the following is a Newly Added Code

    SupplierAMImpl am = ( SupplierAMImpl )pageContext.getApplicationModule(webBean);

    if( pageContext.getParameter("Go")!=null)

    {

    am.setSearchParams(pageContext, webBean);

    }

    if( pageContext.getParameter("Clear")!=null)

    {

    am.clearForm(pageContext, webBean); // it is user defined method.

    }

  • 5/20/2018 OAF Basics

    51/84

    Raaj NagulapalliM.C.A

    51

    //the above is a Newly Added Code

    }

    }

    ==================================================

    SupplierAMImpl.java (the code , which is added is being highlighted with bold and big font )

    package ge.oracle.apps.po.supp.server;

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

    import oracle.jbo.server.ApplicationModuleImpl;

    import ge.oracle.apps.po.supp.lov.server.SupplierTypeLovVoImpl;

    import ge.oracle.apps.po.supp.lov.server.SupplierNumberLovVOImpl;

    // newly added packages

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

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

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

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

    // ---------------------------------------------------------------

    // --- File generated by Oracle Business Components for Java.

    // ---------------------------------------------------------------

    public class SupplierAMImpl extends OAApplicationModuleImpl

    {

    /**

    *

    * This is the default constructor (do not remove)

    */

    public SupplierAMImpl()

    {

    }

    /**

    *

    * Sample main for debugging Business Components code using the tester.

    */

    public static void main(String[] args)

    {

    launchTester("ge.oracle.apps.po.supp.server", "SupplierAMLocal");

    }

  • 5/20/2018 OAF Basics

    52/84

    Raaj NagulapalliM.C.A

    52

    /**

    *

    * Container's getter for SupplierTypeLovVo

    */

    public SupplierTypeLovVoImpl getSupplierTypeLovVo()

    {

    return (SupplierTypeLovVoImpl)findViewObject("SupplierTypeLovVo");

    }

    /**

    *

    * Container's getter for SupplierNumberLovVO

    */

    public SupplierNumberLovVOImpl getSupplierNumberLovVO()

    {

    return (SupplierNumberLovVOImpl)findViewObject("SupplierNumberLovVO");

    }

    /** Container's getter for SiteDetailsVO */

    public SiteDetailsVOImpl getSiteDetailsVO()

    {

    return (SiteDetailsVOImpl)findViewObject("SiteDetailsVO");

    }

    //the following two methods are a newly added methodspublic void setSearchParams(OAPageContext pageContext, OAWebBean webBean)

    {

    SiteDetailsVOImpl vo = getSiteDetailsVO();

    String suppName=pageContext.getParameter("SupplierName");

    String suppNum=pageContext.getParameter("SupplierNumber");

    String suppType=pageContext.getParameter("SupplierType");

    vo.setWhereClauseParam(0,suppName); // in java index is 0, in Query bind param is 1.

    vo.setWhereClauseParam(1,suppType);

    vo.setWhereClauseParam(2,suppNum);

    vo.executeQuery();

    }

    public void clearForm(OAPageContext pageContext, OAWebBean webBean)

    {

    SiteDetailsVOImpl vo = getSiteDetailsVO();

  • 5/20/2018 OAF Basics

    53/84

    Raaj NagulapalliM.C.A

    53

    OAMessageTextInputBean suppNameBean = ( OAMessageTextInputBean )

    webBean.findChildRecursive("SupplierName");

    suppNameBean.setValue(pageContext, null );

    OAMessageLovInputBean suppTypeBean =( OAMessageLovInputBean )

    webBean.findChildRecursive("SupplierType");

    suppTypeBean.setValue(pageContext,null );

    OAMessageLovInputBean suppNumber =( OAMessageLovInputBean )

    webBean.findChildRecursive("SupplierNumber");

    suppNumber.setValue(pageContext,null );

    vo.setWhereClauseParam(0,"####"); // here # is a junk char to make the condition as false

    vo.setWhereClauseParam(1,"####");

    vo.setWhereClauseParam(2,"####");

    vo.executeQuery();

    }

    //the above two methods are a newly added methods

    }

    Search based on where clause parameters

  • 5/20/2018 OAF Basics

    54/84

    Raaj NagulapalliM.C.A

    54

    In the above search should be done in the following ways

    1) if all fields null, then displaying all records

    2) if Supplier Nameis entered, then based on Supplier Name

    3) if Supplier Typeis entered, then based on Supplier Type

    4) ifSupplier Number entered, then based on Supplier Number

    5) if all are entered, then based on all.

    1) Create SupplierSearchPG

    Properties

    Id : RootRN

    Window Title :Supplier Search Page

    Title : Supplier Search

    Create header Region for layout designing

    Properties :

    Id : HeaderRN1

    Text : Search By

    1) Create a Region ( SupplierDetailsRN ) for to hold SupplierId, StartDate, OnHoldFlag and EndDate

    Region Style asmessageComponentLayout

    Rows : 2

    Columns : 2

    UnderSupplierDetailsRN,

    Create 1) messageTextInput field for SupplierId

    2)messageTextInput field forStartDate ( Date type)

    3) messageChoiceBox field for OnHoldFlag4)messageTextInput field forEndDate ( Date type)

    Create Region ( ButtonRN ) for the Buttons ( Submit and Clear ) with properties

    region style :rowlayout

    Horizontal Alignment : centre

    AddGo and Clearwith itemStyle assubmitButton

    2) Create VO for SupplierSerachDetailsVO inside the .server package.

    SELECT fs.SUPPLIER_ID,fst.SITE_NAME,

    fst.SUPPLIER_SITE_ID,

    fs.ON_HOLD_FLAG,

    fs.START_DATE,

    fs.END_DATE

    FROM fwk_tbx_suppliers fs, fwk_tbx_supplier_sites fst

  • 5/20/2018 OAF Basics

    55/84

    Raaj NagulapalliM.C.A

    55

    WHERE fs.supplier_id = fst.supplier_id

    AND fs.SUPPLIER_ID like nvl(:1,fs.SUPPLIER_ID)

    AND fs.ON_HOLD_FLAG like nvl(:2,fs.ON_HOLD_FLAG)

    AND nvl(fs.START_DATE,sysdate )

  • 5/20/2018 OAF Basics

    56/84

    Raaj NagulapalliM.C.A

    56

    View Instance : SiteDetailsTableVO

    Create the Columns for the Site Details

    Supplier Name Supplier Number Supplier Site Supplier Type Country Code

    1) Supplier Name

    SiteTableRN New Column

    Properties :

    Column Id :SuppName

    Create Item under the Column (SuppName )

    Id : SuppName1

    Item Style :messageStyleText

    View Attribute :SupplierName

    ColumnHeaderNew sortableHeader

    Properties :

    Prompt :Supplier Name

    2)Supplier Number

    SiteTableRN New Column

    Properties :

    Column Id :SuppNum

    Create Item under the Column (SuppNum )

    Id : SuppNum1Item Style :messageStyleText

    View Attribute :SupplierName

    ColumnHeaderNew sortableHeader

    Properties :

    Prompt :Supplier Number

    3) Supplier Site

    SiteTableRN New Column

    Properties :

    Column Id :SuppSite

    Create Item under the Column (SuppSite )

    Id : SuppSite1

    Item Style :messageStyleText

    View Attribute :SupplierSite

    ColumnHeaderNew sortableHeader

  • 5/20/2018 OAF Basics

    57/84

    Raaj NagulapalliM.C.A

    57

    Properties :

    Prompt :Supplier Site

    4) Supplier Type

    SiteTableRN New Column

    Properties :

    Column Id :SuppType

    Create Item under the Column (SuppType)

    Id : SuppType1

    Item Style :messageStyleText

    View Attribute :SupplierType

    ColumnHeaderNew sortableHeader

    Properties :

    Prompt :SupplierType

    5) Country Code

    SiteTableRN New Column

    Properties :

    Column Id :Country

    Create Item under the Column (Country)

    Id : Country1

    Item Style :messageStyleText

    View Attribute : CountryCode

    ColumnHeader

    New

    sortableHeaderProperties :

    Prompt : Country Code

  • 5/20/2018 OAF Basics

    58/84

    Raaj NagulapalliM.C.A

    58

    Page design is as shown below

    8) Create Controller on the Page under the package .webui

    Class Name : SupplierSearchCO

    Write the following code :

    The code, which is added to existing one is being highlighted with Bold and Big font

    /*===========================================================================+| Copyright (c) 2001, 2003 Oracle Corporation, Redwood Shores, CA, USA |

    | All rights reserved. |

    +===========================================================================+

    | HISTORY |

    +===========================================================================*/

    package ge.oracle.apps.po.supp.server.webui;

    SupplierNumer & SupplierType

    ( LOV Item )

    AdvancedTable Region

    Column

    Items with messageStyledText

    Sortable Header ( Column Names )

  • 5/20/2018 OAF Basics

    59/84

    Raaj NagulapalliM.C.A

    59

    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;

    // newly added package

    import ge.oracle.apps.po.supp.server.SupplierAMImpl;

    /**

    * Controller for ...

    */

    public class SupplierSearchCO extends OAControllerImpl

    {

    public static final String RCS_ID="$Header$";

    public static final boolean RCS_ID_RECORDED =

    VersionInfo.recordClassVersion(RCS_ID, "%packagename%");

    /**

    * Layout and page setup logic for a region.

    * @param pageContext the current OA page context

    * @param webBean the web bean corresponding to the region

    */

    public void processRequest(OAPageContext pageContext, OAWebBean webBean)

    {

    super.processRequest(pageContext, webBean);

    }

    /*** Procedure to handle form submissions for form elements in

    * a region.

    * @param pageContext the current OA page context

    * @param webBean the web bean corresponding to the region

    */

    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)

    {

    super.processFormRequest(pageContext, webBean);

    //the following is a Newly Added CodeSupplierAMImpl am = ( SupplierAMImpl )pageContext.getApplicationModule(webBean);

    if( pageContext.getParameter("Go")!=null)

    {

    am.setSearchParams(pageContext, webBean);

    }

    if( pageContext.getParameter("Clear")!=null)

    {

    am.clearForm(pageContext, webBean);

    }

    //the above is a Newly Added Code

  • 5/20/2018 OAF Basics

    60/84

    Raaj NagulapalliM.C.A

    60

    }

    }

    ==================================================

    SupplierAMImpl.java (the code , which is added is being highlighted with bold and big font )

    package ge.oracle.apps.po.supp.server;

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

    import oracle.jbo.server.ApplicationModuleImpl;

    import ge.oracle.apps.po.supp.lov.server.SupplierTypeLovVoImpl;

    import ge.oracle.apps.po.supp.lov.server.SupplierNumberLovVOImpl;

    // newly added packages

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

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

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

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

    // ---------------------------------------------------------------

    // --- File generated by Oracle Business Components for Java.

    // ---------------------------------------------------------------

    public class SupplierAMImpl extends OAApplicationModuleImpl

    {

    /***

    * This is the default constructor (do not remove)

    */

    public SupplierAMImpl()

    {

    }

    /**

    ** Sample main for debugging Business Components code using the tester.

    */

    public static void main(String[] args)

    {

    launchTester("ge.oracle.apps.po.supp.server", "SupplierAMLocal");

    }

  • 5/20/2018 OAF Basics

    61/84

    Raaj NagulapalliM.C.A

    61

    /**

    *

    * Container's getter for SupplierTypeLovVo

    */

    public SupplierTypeLovVoImpl getSupplierTypeLovVo()

    {

    return (SupplierTypeLovVoImpl)findViewObject("SupplierTypeLovVo");

    }

    /**

    *

    * Container's getter for SupplierNumberLovVO

    */

    public SupplierNumberLovVOImpl getSupplierNumberLovVO()

    {

    return (SupplierNumberLovVOImpl)findViewObject("SupplierNumberLovVO");

    }

    /** Container's getter for SiteDetailsVO */

    public SiteDetailsVOImpl getSiteDetailsVO()

    {

    return (SiteDetailsVOImpl)findViewObject("SiteDetailsVO");

    }

    //the following two methods are a newly added methodspublic void setSearchParams(OAPageContext pageContext, OAWebBean webBean)

    {

    SiteDetailsVOImpl vo = getSiteDetailsVO();

    String suppName=pageContext.getParameter("SupplierName");

    String suppNum=pageContext.getParameter("SupplierNumber");

    String suppType=pageContext.getParameter("SupplierType");

    vo.setWhereClauseParam(0,suppName); // in java index is 0, in Query bind param is 1.

    vo.setWhereClauseParam(1,suppType);

    vo.setWhereClauseParam(2,suppNum);

    vo.executeQuery();

    }

    public void clearForm(OAPageContext pageContext, OAWebBean webBean)

    {

    SiteDetailsVOImpl vo = getSiteDetailsVO();

    OAMessageTextInputBean suppNameBean = ( OAMessageTextInputBean )

    webBean.findChildRecursive("SupplierName");

  • 5/20/2018 OAF Basics

    62/84

    Raaj NagulapalliM.C.A

    62

    suppNameBean.setValue(pageContext, null );

    OAMessageLovInputBean suppTypeBean =( OAMessageLovInputBean )

    webBean.findChildRecursive("SupplierType");

    suppTypeBean.setValue(pageContext,null );

    OAMessageLovInputBean suppNumber =( OAMessageLovInputBean )

    webBean.findChildRecursive("SupplierNumber");

    suppNumber.setValue(pageContext,null );

    vo.setWhereClauseParam(0,"####"); // here # is a junk char to make the condition as false

    vo.setWhereClauseParam(1,"####");

    vo.setWhereClauseParam(2,"####");

    vo.executeQuery();

    }

    //the above two methods are a newly added methods

    }

    Steps to Register a Page with Oracle apps server

    1) Take the package folder from themyclassesfolderC:\Jdev\jdevhome\jdev\myclasses name of the package ( test.oracle.apps.po.hello.webui )Copy thetestfolder from the myclasses

  • 5/20/2018 OAF Basics

    63/84

    Raaj NagulapalliM.C.A

    63

    2) upload ( Paste ) the Folder into the following location of Apps Server

    D:\oracle\viscomn\java

    3) prepare the following script

    D:\Jdev\jdevhome\jdev\myprojects\test\oracle\apps\po\hello\webui\HelloPG.xml -username apps -password apps -rootdirD:\jdev\jdevhome\jdev\myprojects\ -dbconnection

    "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=APPS.ora.com)(PORT=1521))(CONNECT_DATA=(SID=VIS))

    4) Run the Script at Command Prompt

    C:\Jdev\jdevbin\jdev\bin > import D:\Jdev\jdevhome\jdev\myprojects\test\oracle\apps\po\hello\webui\HelloPG.xml -username apps -password apps -rootdir D:\jdev\jdevhome\jdev\myprojects\ -dbconnection"(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=APPS.ora.com)(PORT=1521))(CONNECT_DATA=(SID=VIS))

    5) Create the Function :Go to Application Developer->Application->Function

  • 5/20/2018 OAF Basics

    64/84

    Raaj NagulapalliM.C.A

    64

    Specify the function Name in the following and copy the User Function Name: HELLOPGFUNCTION into notepad )

    Go to Properties select type as SSWAJsp Function as shown below

  • 5/20/2018 OAF Basics

    65/84

    Raaj NagulapalliM.C.A

    65

    Go to Web HTML ( tab) and call specify the Page URL

    OA.jsp?page=/test/oracle/apps/po/hello/webui/HelloPG ( should be forward slash for the path specification )Save the above

    Attach the User Function Name to Menu of Perticular Responisbility

    Eg : Purchasing Vision Operations ( USA )

    System Administrator Security Responsibilty Define

  • 5/20/2018 OAF Basics

    66/84

    Raaj NagulapalliM.C.A

    66

  • 5/20/2018 OAF Basics

    67/84

    Raaj NagulapalliM.C.A

    67

    Query for the Responsibilty Purchasing Vision Operations ( USA )

    Get the Menu Name : Purchasing SuperUser GUI

  • 5/20/2018 OAF Basics

    68/84

    Raaj NagulapalliM.C.A

    68

    Go To Application DeveloperMenuQuery for the Menu as Shown Below

    Attach the User Function Name ( HELLOPGFUNCTION, which was taken into notepad ) to Menu as shown below

  • 5/20/2018 OAF Basics

    69/84

    Raaj NagulapalliM.C.A

    69

    Save the aboveUp on saving it will run a request to register the form

    Click on OK in the following

  • 5/20/2018 OAF Basics

    70/84

    Raaj NagulapalliM.C.A

    70

    Go to View requests and find for the Request

    Bounce the Apache

    Restart Services ( Oracle Appache Server VIS_Apps )

    Go to Purchasig Vision Operations ( USA ) and select the function : HelloPage ( prompt )

  • 5/20/2018 OAF Basics

    71/84

    Raaj NagulapalliM.C.A

    71

    CRUD Application : Adding New Records:

    When Click on AddAnotherRow Button , it should display following to add the new record.

  • 5/20/2018 OAF Basics

    72/84

    Raaj NagulapalliM.C.A

    72

    In the above SupplierId Value should be populated from the Database Sequence automatically.

    1) Create AM (SupplierAM ) under the supp.oracle.apps.po.create.server

    2) Create the Page : ( SupplierCreationPG.xml )

    Package : supp.oracle.apps.po.create.webui

    Set the propertiesId : RootRNAM Definition : SupplierAMWindow Title :Title :

    Create a Region with messageComponentLayout ( Rows : 2, Cols : 2 ) for the followingId : SupplierRN

    1) SupplierId ( messageStyledText , since its value will be populated from the sequence )2) SupplierName ( messageTextInput )3) StartDate ( Date Type )4) EndDate ( Date Type )

    Create Button Region with Region Style as pageButtonBarId : ButtonRN

    Addsubmitand backbuttons ( ItemStyle as submittButton )

  • 5/20/2018 OAF Basics

    73/84

    Raaj NagulapalliM.C.A

    73

    1) Id : submitItemStyle : submittButton

    2) Id : backItemStyle : submittButton

    3) place the spacer between the buttons.

    3) Create EO under schema.server for Supplier Details ( since inserting into database )

    1) create supp.oracle.apps.po.create.schema.server package2) create EO under the above package

    Rt.Click on supp.oracle.apps.po.create.schema.server Package and create EO

    New Entity Object NextName : SupplierTableEOPackage : supp.oracle.apps.po.create.schema.server

    Schema Object : FWK_TBX_SUPPLIERSDatabase Schema : APPSTables (Check ) Views ( No Check ) Synonyms ( No Check ) Snapshots( No Check )

    NextEntity Attributes ( displayed )

    Next Next Next Next Finish

    4) Create VO for Supplier Details, based on above EO (SupplierTableEO ) under the .serverpackage

    Rt.Click on supp.oracle.apps.po.create.server packageNew View Object Next

    Name : SupplierTableVOPackage : supp.oracle.apps.po.create.server

    Available :

    supp.oracle.apps.po.create.schema.serverSupplierTableEO ( select ) and shuttle to right

    Next>> ( shuttle all the fields or required fields )

    Next Next

    CheckExpert Mode ( to make the query as editable )

    Check Test ( as desired )

    Next it shows all Query Columnsand View Attributes

    Next Next Finish

    Note :the above create VO is called as EO based VO, which can be used to perform DML operations through EO

    5) Shuttel VO to AM ( SupplierAM )

    6) Go to Page andSupplierRN

    Go to itemSupplierId

    Properties :

  • 5/20/2018 OAF Basics

    74/84

    Raaj NagulapalliM.C.A

    74

    View Instance : SupplierTableVOView Attribute : SupplierId

    Go to itemSupplierNameProperties :

    View Instance : SupplierTableVOView Attribute : Name

    Go to item StartDateProperties :View Instance : SupplierTableVOView Attribute : StartDate

    Go to item EndDate

    Properties :View Instance : SupplierTableVO

    View Attribute : EndDate

    6) Create EO for site details under the package : supp.oracle.apps.po.create.schema.server

    Name : SiteTableEOPackage : supp.oracle.apps.po.create.schema.serverSchema Object : FWK_TBX_SUPPLIER_SITESDatabase Schema : APPS

    Next Next Next Next Next Finish

    7) Create VO for Site Details, based on above EO (SiteTableEO) under the .serverpackage

    Rt.Click on supp.oracle.apps.po.create.server packageNew View Object Next Name : SiteTableVOPackage : supp.oracle.apps.po.create.server

    Available :

    supp.oracle.apps.po.create.schema.serverSiteTableEO ( select ) and shuttle to right

    Next >> ( shuttle all the fields or required fields )

    Next NextCheck Expert Mode Next Next Next Finish

    8) Shuttle above VO to AM ( SupplierAM )

    9) Go To SupplierCreationPG Structure

    Go To RootRN and create the Region for Site DetailsId:SiteDetailsRNRegion Style : advancedTableView Instance : SiteTableVOWidth : 75%Add the following columns to advanced table Region ( SiteDetailsRN)

    1) Coulmn1

    Rt.Click ItemId: SiteName ( messageTextInput )

  • 5/20/2018 OAF Basics

    75/84

    Raaj NagulapalliM.C.A

    75

    View Attribute : SiteNameColumnHeader Rt.Click

    SortableHeaderPrompt : SiteName

    2) Coulmn2Rt.Click Item

    Id: Address ( messageLovInput )

    View Attribute : AddressIdColumnHeader Rt.ClickSortableHeaderPrompt : Address

    3) Coulmn3Rt.Click Item

    Id: PaymentTerms ( messageLovInput )View Attribute : PaymentTermsCode

    ColumnHeader Rt.ClickSortableHeaderPrompt : PaymentTerms

    4) Coulmn4Rt.Click Item

    Id: CarrierCode ( messageLovInput )View Attribute : CarrierCode

    ColumnHeader Rt.ClickSortableHeaderPrompt : CarrierCode

    5) Coulmn5

    Rt.Click ItemId: PurchaseSiteFlag ( messageChoice )View Attribute : PurchasingSiteFlag

    ColumnHeader Rt.ClickSortableHeaderPrompt : PurchaseSiteFlag

    6) Column6Rt.Click Item

    Id: Edate ( messageTextInput : Date type )View Attribute :EndDate

    ColumnHeader Rt.ClickSortableHeaderPrompt : EndDate

    11 ) create VOs for Address ( Column2 ), PaymentTerms ( Column3 ), CarrierCode ( Column4) andLov VOs must be created inside of lov.server package.Create supp.oracle.apps.po.create.lov.server

    1) Address ( Column2 )Name : AdressDetailsLovVO

    Package : supp.oracle.apps.po.create.lov.server

    Query : select address_id, address_name from FWK_TBX_ADDRESSES

  • 5/20/2018 OAF Basics

    76/84

    Raaj NagulapalliM.C.A

    76

    2) PaymentTerms ( Column3 )Name : PaymentTermsLovVOPackage : supp.oracle.apps.po.create.lov.server

    Query :select lookup_code, meaning from FWK_TBX_LOOKUP_CODES_VL where lookup_type =

    'FWK_TBX_PAYMENT_TERMS'

    3) CarrierCode ( Column4)

    Name : CarrierCodeLovVOQuery :

    select lookup_code, meaning from FWK_TBX_LOOKUP_CODES_VLwhere lookup_type = 'FWK_TBX_CARRIER'

    12) Shuttle all the above Vos to AM in side .lov.server packageCreate AM inside the lov.server package

    Name : SuppLovAMShuttle Vos to SuppLovAM

    13) Create External Regions for 1) AdressDetailsLovVO, 2) PaymentTermsLovVO 3) CarrierCodeLovVOand Add Vos to External Regions.

    1) AdressDetailsLovVO,

    Create Region ( Rt.Click on .jpr and cr