Vous êtes sur la page 1sur 84

ORACLE APPLICATION FRAMEWORK

Oracle Application Framework (OA Framework) is the Oracle Applications development and deployment platform for HTML-based business applications.

Simple Web Application Architecture ( Servlet / JSP ) :

Client Tier HTTP Request

Application - Tier

Database - Tier

Application Components WEB CLIENT


HTTP Response

Servlet / JSP

Data Base

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 Presentation Logic. 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 being developed as single component.

To overcome the above disadvantages MVC1 Architecture was introduced

Raaj Nagulapalli
M.C.A

MVC1 Architecture : M Model V View C Controller

Client Tier

Application - Tier

Database Tier

HTTP Request

Application Components Servlet / JSP Java Bean Data Base

WEB CLIENT
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 that manipulates 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

Raaj Nagulapalli
M.C.A

MVC2 Architecture :

Struts Frame work follows the MVC2 Architecture

Client Tier

Application - Tier

Database Tier

HTTP Request

Controller WEB CLIENT

Model

Data Base

HTTP Response

View

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 Bean called as Form Bean (Model) and receives response (success / fail) from the Form Bean. Based on the response from Form Bean, 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 data validations or data base transactions such DML and DQL operations. After performing database transactions it provides the data for the view.

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

Raaj Nagulapalli
M.C.A

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

Model
HTTP Request

Controller1, 2,3, 4 n

VO A
M EO

WEB CLIENT
HTTP Response

Data Base

View

AM Application Module

VO View Object

EO Entity Object

Controller : It is a Java Class. OAControllerImpl is 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

Raaj Nagulapalli
M.C.A

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.

Comparison of D2k , OAF and ADF

D2k Stand Alone Application From Builder used to develop the applications PL/SQL Drag and Drop features Desk Top Application

OAF MVC Architecture JDeveloper is used to develop the applications JAVA No Drag and Drop features Web Application

ADF MVC Architecture JDeveloper is used to develop the applications JAVA Drag and Drop features Enterprise Applicaion

Raaj Nagulapalli
M.C.A

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 Click New database connection Next Connection Name : test ( as desired ) Connection Type : Oracle ( JDBC ) Next : 2) User Name Password Role Next : apps : apps : not necessary ( Roles such as site level, user level, application level )

Raaj Nagulapalli
M.C.A

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) <3rd party identifier > .oracle.apps.<application_short_name>.<component>.[<sub-component>] .webui 2) <3 party identifier > .oracle.apps.<application_short_name>.<component>.[<sub-component>] lov.webui 3) <3rd party identifier > .oracle.apps.<application_short_name>.<component>.[<sub-component>] .server 4) <3 party identifier > .oracle.apps.<application_short_name>.<component>.[<sub-component>] lov.server 5) <3 party identifier > .oracle.apps.<application_short_name>.<component>.[<sub-component>] poplist.server 6) <3 party identifier > .oracle.apps.<application_short_name>.<component>.[<sub-component>] Schema.server
rd rd rd rd

Steps to Develop the Application

Eg: Hello Page

Raaj Nagulapalli
M.C.A

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 ) Select Add 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 <3rd party identifier > .oracle.apps.<application_short_name>.<component>.[<sub-component>].webui In the above <3rd party identifier > mnrao <application_short_name> po <component> welcomponent [<sub-component>] 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 Here New 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 )

Raaj Nagulapalli
M.C.A

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 ( Select Entity 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 OK Name : 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

Raaj Nagulapalli
M.C.A

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

10

Raaj Nagulapalli
M.C.A

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

11

Raaj Nagulapalli
M.C.A

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 : messageRadioButton Group 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 :

12

Raaj Nagulapalli
M.C.A

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

13

Raaj Nagulapalli
M.C.A

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 is PageLayout It follows the java beans hierarchy The regions in the same node level are called as SIBLINGS . 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 Region Region 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 : 2 Coulmns : 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

14

Raaj Nagulapalli
M.C.A

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 :

Pre

Next

Pre

Next

Here Pre and Next buttons ItemStyle is : submitButton rowLayout Region : To align the components in a Single Row with N No.of Columns Properties : Horizontal Alignment : Centre Vertical Alignment : Left Content Container Region : It is region with some background such as letter pads Properties : Background style : transparent, flexible Width : 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

15

Raaj Nagulapalli
M.C.A

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 the DemoLovItemPG.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 : 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

16

Raaj Nagulapalli
M.C.A

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 OK next 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 using TOAD 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.Click New Table Using Wizard Next Application Module : test.oracle.apps.po.orgid.server Available 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)

17

Raaj Nagulapalli
M.C.A

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 : DemoPG Controller 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, 2) proceesFromData ( OAPageContext pageContext, OAWebBean webBean ); OAWebBean webBean ); OAWebBean webBean );

3) proceesFormRequest ( OAPageContext pageContext,

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

18

Raaj Nagulapalli
M.C.A

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

19

Raaj Nagulapalli
M.C.A

*/ 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

20

Raaj Nagulapalli
M.C.A

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

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)

21

Raaj Nagulapalli
M.C.A

{ 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

22

Raaj Nagulapalli
M.C.A

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 the DemoLovItemPG.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 : header Text : Enter Details Create item1 with Item Style as messageLovInput Region2 ( Header ) Rt.Click item Item properties : Id : organizationID Item Style : messageLovInput

23

Raaj Nagulapalli
M.C.A

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 and modify to test.oracle.apps.po.orgid.lov.server Next OK next 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 using TOAD 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.Click New Table Using Wizard Next Application Module : test.oracle.apps.po.orgid.server Available View usage select OrganizationLovVO

24

Raaj Nagulapalli
M.C.A

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 AM 3) Create External Region Name : as desired Style : listofvalues Package : < > . <component>.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

25

Raaj Nagulapalli
M.C.A

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 the DemoLovItemPG.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 messageLovInput Region2 Rt.Click item Item properties : Id : SupplierID Item Style : messageLovInput Prompt : 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

26

Raaj Nagulapalli
M.C.A

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 OK next 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 using TOAD tool (ok 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 OK Name : 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

Select SuppDetailsLOVRN.xml file and go to structure Select 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

27

Raaj Nagulapalli
M.C.A

Select SuppDetailsLOVRN.xml and 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

28

Raaj Nagulapalli
M.C.A

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 : QueryRN : 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.TestAm Available 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 as search allow true Here EmployeeId and Title are set as search allow true. Hence the following form showing with

29

Raaj Nagulapalli
M.C.A

EmployeeId : Title : Type the values and select Go

Advanced search is based on some conditions

30

Raaj Nagulapalli
M.C.A

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 2) Go to EmpQueryDetailsTableRN New Switcher Region --> Id : SwitcherRN Rt.Click on SwitcherRN 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 on SwitcherRN 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 the application. Alias_name

31

Raaj Nagulapalli
M.C.A

Steps to write the Prepared 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

32

Raaj Nagulapalli
M.C.A

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

33

Raaj Nagulapalli
M.C.A

* @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;

34

Raaj Nagulapalli
M.C.A

// --------------------------------------------------------------// --- 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 database public 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();

35

Raaj Nagulapalli
M.C.A

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 Statement is an interface from java.sql package It is used to execute the stored procedure

36

Raaj Nagulapalli
M.C.A

Stored Procedure : It is a set statements at the database server. It contains statements such as SELECT, INSERT, DELETE, UPDATE and also statements to perform validations It carries three types of parameters 1) in to pass the value 2) out to return the value 3) in-out to pass as well as to return the value

Advantages in using stored procedure : 1) It improves the performance of the application 2) 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

37

Raaj Nagulapalli
M.C.A

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.NUMERIC Types.DOUBLE

Types.TINYINT Types.DECIMAL; Types.CHAR Types.TIMESTAMP Types.VARBINARY

Types.INTEGER Types.BIGINT Types.FLOAT Types.VARCHAR Types.DATE Types.BINARY Types.REAL

Types.LONGVARCHAR Types.TIME Types.BLOB Types.CLOB

Example :

38

Raaj Nagulapalli
M.C.A

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 ) IS BEGIN INSERT INTO STUDENT VALUES ( ROLLNO, NAME, AGE); COMMIT; retCode :=0; EXCEPTION WHEN OTHERS THEN retCode:=1; END; /

xxAMImpl.java coding

39

Raaj Nagulapalli
M.C.A

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;

40

Raaj Nagulapalli
M.C.A

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; } } } }

41

Raaj Nagulapalli
M.C.A

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, "%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);

42

Raaj Nagulapalli
M.C.A

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

43

Raaj Nagulapalli
M.C.A

In the above search should be done in the following ways 1) if all fields null, then displaying all records 2) if Supplier Name is entered, then based on Supplier Name 3) if Supplier Type is entered, then based on Supplier Type 4) if Supplier 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 Search

Create header Region for layout designing Properties : Id : Header Text : Search By Create a Region ( SupplierDetailsRN ) to hold SupplierName, SupplierType and SupplierNumber Region Style as messageComponentLayout

44

Raaj Nagulapalli
M.C.A

Rows : 2 Columns : 2 Under SupplierDetailsRN, 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 Add Go and Clear with itemStyle as submitButton

2) Create VO for SupplierType and SupplierNumber and suttle to AM Create SupplierSearchAM inside of test.oracle.apps.po.supp.lov.server Create SupplierType VO under .lov.server package Query : select pv.VENDOR_TYPE_LOOKUP_CODE "Vendor Type" from po_vendors pv

Create SupplierNumber VO under .lov.server package Select pv.SEGMENT1 suttle both to AM "Vendor Number" from po_vendors pv

3) create external regions for SupplierType and SupplierNumber

Create SupplierType Region under .webui package Name : SupplierTypeLovRN Package : 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 : table Search Allow : True for SupplierType Create SupplierNumber Region under .webui package Name : SupplierNumberLovRN Package : test.oracle.apps.po.supp.webui Style : listOfValues Scope : public

45

Raaj Nagulapalli
M.C.A

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 to SupplierType

Go to SupplierType Properties

item in the Page

External Lov : /test/oracle/apps/po/supp/webui/SupplierTypeLovRN Lov Mappings Lov Region Item : VendorType Return Item : SupplierType Criteria Item : SupplierType

Add to SupplierNumber

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 pv.SEGMENT1 pvsa.VENDOR_SITE_CODE pv.VENDOR_TYPE_LOOKUP_CODE pvsa.COUNTRY Supplier Name", "Supplier Number", "Supplier Site", "Supplier Type",

"Country Code"

46

Raaj Nagulapalli
M.C.A

from po_vendors pv, po_vendor_sites_all pvsa where pv.VENDOR_ID = pvsa.VENDOR_ID

and and and

pv.VENDOR_NAME like nvl(:1, pv.VENDOR_NAME) pv.VENDOR_TYPE_LOOKUP_CODE like nvl(:2, pv.VENDOR_TYPE_LOOKUP_CODE) 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 : Column1 Create Item under the Column (SuppName ) Id : SuppName Item Style : messageStyleText View Attribute : SupplierName ColumnHeader New sortableHeader Properties : Prompt : Supplier Name 2) Supplier Number SiteTableRN New Column Properties : Column Id : Column2 Create Item under the Column (SuppNum ) Id : SuppNum Item Style : messageStyleText View Attribute : SupplierName

47

Raaj Nagulapalli
M.C.A

ColumnHeader New 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 ColumnHeader New 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 : SupplierType ColumnHeader New 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 ColumnHeader New sortableHeader Properties : Prompt : Country Code

48

Raaj Nagulapalli
M.C.A

Page design is as shown below

SupplierNumer & SupplierType ( LOV Item )

AdvancedTable Region Column Sortable Header ( Column Names ) Items with messageStyledText

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;

49

Raaj Nagulapalli
M.C.A

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. }

50

Raaj Nagulapalli
M.C.A

//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"); }

51

Raaj Nagulapalli
M.C.A

/** * * 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 methods public 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();

52

Raaj Nagulapalli
M.C.A

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

53

Raaj Nagulapalli
M.C.A

In the above search should be done in the following ways 1) if all fields null, then displaying all records 2) if Supplier Name is entered, then based on Supplier Name 3) if Supplier Type is entered, then based on Supplier Type 4) if Supplier 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 as messageComponentLayout Rows : 2 Columns : 2 Under SupplierDetailsRN, Create 1) messageTextInput field for SupplierId 2) messageTextInput field for StartDate ( Date type) 3) messageChoiceBox field for OnHoldFlag 4) messageTextInput field for EndDate ( Date type)

Create Region ( ButtonRN ) for the Buttons ( Submit and Clear ) with properties region style : rowlayout Horizontal Alignment : centre Add Go and Clear with itemStyle as submitButton

2) Create VO for SupplierSerachDetailsVO SELECT fs.SUPPLIER_ID, fst.SITE_NAME,

inside the .server package.

fst.SUPPLIER_SITE_ID, fs.ON_HOLD_FLAG, fs.START_DATE, fs.END_DATE FROM fwk_tbx_suppliers fs, fwk_tbx_supplier_sites fst

54

Raaj Nagulapalli
M.C.A

WHERE AND AND AND

fs.supplier_id = fst.supplier_id fs.SUPPLIER_ID like nvl(:1,fs.SUPPLIER_ID) fs.ON_HOLD_FLAG like nvl(:2,fs.ON_HOLD_FLAG) nvl(fs.START_DATE,sysdate )<= nvl(:3,nvl(fs.START_DATE,sysdate ))

Shuffle the above VO to AM ( AM inside the server package : SuppAM) 7) Go to SupplierSerachPG a) Go to RootRN Create HeaderRN2 Rt.Click Region Using Wizard Next Available View Usage : SupplierSearchDetailsVO Region Id : SupplierSerachDetailsTableRN Region Style : table Next shuttle all fields Next change the item style of all items to messageStyleText Next Finish b) Add Update and Delete Columns to the table 1) Update Id : Update Item Style : image Prompt : Update Image URI : updateicon_enabled.gif Action Type : fireAction Event : UpdateButtonClick Parameters : ( called as SPEL parameters ) Name Supid Siteid Value ${oa. SupplierSerachDetailsVO.SupplierId} ${oa. SupplierSerachDetailsVO.SupplierSiteId}

2) Delete Id : Delete Item Style : image Prompt : Delete Image URI : deleteicon_enabled.gif Action Type : fireAction Event : DeleteButtonClick Parameters : ( called as SPEL parameters ) Name Value

delsupid ${oa. SupplierSerachDetailsVO.SupplierId} Siteid ${oa. SupplierSerachDetailsVO.SupplierSiteId}

55

Raaj Nagulapalli
M.C.A

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 ColumnHeader New sortableHeader Properties : Prompt : Supplier Name 2) Supplier Number SiteTableRN New Column Properties : Column Id : SuppNum Create Item under the Column (SuppNum ) Id : SuppNum1 Item Style : messageStyleText View Attribute : SupplierName ColumnHeader New 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 ColumnHeader New sortableHeader

56

Raaj Nagulapalli
M.C.A

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 ColumnHeader New 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 sortableHeader Properties : Prompt : Country Code

57

Raaj Nagulapalli
M.C.A

Page design is as shown below

SupplierNumer & SupplierType ( LOV Item )

AdvancedTable Region Column Sortable Header ( Column Names ) Items with messageStyledText

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;

58

Raaj Nagulapalli
M.C.A

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 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); } //the above is a Newly Added Code

59

Raaj Nagulapalli
M.C.A

} }

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

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"); }

60

Raaj Nagulapalli
M.C.A

/** * * 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 methods public 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");

61

Raaj Nagulapalli
M.C.A

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 the myclasses folder C:\Jdev\jdevhome\jdev\myclasses name of the package ( test.oracle.apps.po.hello.webui ) Copy the test folder from the myclasses

62

Raaj Nagulapalli
M.C.A

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 -rootdir D:\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

63

Raaj Nagulapalli
M.C.A

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

64

Raaj Nagulapalli
M.C.A

Go to Web HTML ( tab) and call

specify the Page URL ( should be forward slash for the path specification )

OA.jsp?page=/test/oracle/apps/po/hello/webui/HelloPG Save the above

Attach the User Function Name to Menu of Perticular Responisbility Eg : Purchasing Vision Operations ( USA ) System Administrator Security Responsibilty Define

65

Raaj Nagulapalli
M.C.A

66

Raaj Nagulapalli
M.C.A

Query for the Responsibilty Purchasing Vision Operations ( USA )

Get the Menu Name : Purchasing SuperUser GUI

67

Raaj Nagulapalli
M.C.A

Go To Application Developer Menu Query for the Menu as Shown Below

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

68

Raaj Nagulapalli
M.C.A

Save the above Up on saving it will run a request to register the form Click on OK in the following

69

Raaj Nagulapalli
M.C.A

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 )

70

Raaj Nagulapalli
M.C.A

CRUD Application : Adding New Records:

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

71

Raaj Nagulapalli
M.C.A

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 properties Id : RootRN AM Definition : SupplierAM Window Title : Title : Create a Region with messageComponentLayout ( Rows : 2, Cols : 2 ) for the following Id : SupplierRN 1) 2) 3) 4) SupplierId ( messageStyledText , since its value will be populated from the sequence ) SupplierName ( messageTextInput ) StartDate ( Date Type ) EndDate ( Date Type )

Create Button Region with Region Style as pageButtonBar Id : ButtonRN Add submit and back buttons ( ItemStyle as submittButton )

72

Raaj Nagulapalli
M.C.A

1) Id : submit ItemStyle : submittButton 2) Id : back ItemStyle : 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 package 2) create EO under the above package Rt.Click on supp.oracle.apps.po.create.schema.server Package and create EO New Entity Object Next Name : SupplierTableEO Package : supp.oracle.apps.po.create.schema.server Schema Object : FWK_TBX_SUPPLIERS Database Schema : APPS Tables (Check ) Views ( No Check ) Synonyms ( No Check ) Next Entity Attributes ( displayed ) Next Next Next Next Finish

Snapshots( No Check )

4) Create VO for Supplier Details, based on above EO (SupplierTableEO ) under the .server package Rt.Click on supp.oracle.apps.po.create.server New View Object Next Name : SupplierTableVO Package : supp.oracle.apps.po.create.server Available : supp.oracle.apps.po.create.schema.server SupplierTableEO ( select ) and shuttle to right Next >> ( shuttle all the fields or required fields ) Next Next Check Expert Mode ( to make the query as editable ) Check Test ( as desired ) Next it shows all Query Columns and 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 package

5) Shuttel VO to AM ( SupplierAM ) 6) Go to Page and SupplierRN Go to item SupplierId Properties :

73

Raaj Nagulapalli
M.C.A

View Instance : SupplierTableVO View Attribute : SupplierId Go to item SupplierName Properties : View Instance : SupplierTableVO View Attribute : Name Go to item StartDate Properties : View Instance : SupplierTableVO View 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 : SiteTableEO Package : supp.oracle.apps.po.create.schema.server Schema Object : FWK_TBX_SUPPLIER_SITES Database Schema : APPS Next Next Next Next Next Finish 7) Create VO for Site Details, based on above EO (SiteTableEO) under the .server package Rt.Click on supp.oracle.apps.po.create.server New View Object Next Name : SiteTableVO Package : supp.oracle.apps.po.create.server package

Available : supp.oracle.apps.po.create.schema.server SiteTableEO ( select ) and shuttle to right Next >> ( shuttle all the fields or required fields ) Next Next Check 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 Details Id: SiteDetailsRN Region Style : advancedTable View Instance : SiteTableVO Width : 75% Add the following columns to advanced table Region ( SiteDetailsRN ) 1) Coulmn1 Rt.Click Item Id: SiteName ( messageTextInput )

74

Raaj Nagulapalli
M.C.A

View Attribute : SiteName ColumnHeader Rt.Click SortableHeader Prompt : SiteName 2) Coulmn2 Rt.Click Item Id: Address ( messageLovInput ) View Attribute : AddressId ColumnHeader Rt.Click SortableHeader Prompt : Address 3) Coulmn3 Rt.Click Item Id: PaymentTerms ( messageLovInput ) View Attribute : PaymentTermsCode ColumnHeader Rt.Click SortableHeader Prompt : PaymentTerms

4) Coulmn4 Rt.Click Item Id: CarrierCode ( messageLovInput ) View Attribute : CarrierCode ColumnHeader Rt.Click SortableHeader Prompt : CarrierCode 5) Coulmn5 Rt.Click Item Id: PurchaseSiteFlag ( messageChoice ) View Attribute : PurchasingSiteFlag ColumnHeader Rt.Click SortableHeader Prompt : PurchaseSiteFlag

6) Column6 Rt.Click Item Id: Edate ( messageTextInput : Date type ) View Attribute :EndDate ColumnHeader Rt.Click SortableHeader Prompt : EndDate

11 ) create VOs for Address ( Column2 ), PaymentTerms ( Column3 ), CarrierCode ( Column4) and Lov 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

75

Raaj Nagulapalli
M.C.A

2) PaymentTerms ( Column3 ) Name : PaymentTermsLovVO Package : 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 : CarrierCodeLovVO Query : select lookup_code, meaning from FWK_TBX_LOOKUP_CODES_VL where lookup_type = 'FWK_TBX_CARRIER'

12) Shuttle all the above Vos to AM in side .lov.server package Create AM inside the lov.server package Name : SuppLovAM Shuttle Vos to SuppLovAM

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

1) AdressDetailsLovVO, Create Region ( Rt.Click on .jpr and create ) Name : AdressDetailsLovRN Package : supp.oracle.apps.po.create.webui Style : LostOfValues Scope : public AM Defintion : SupplierLovAM Add VO (AdressDetailsLovVO ) to AdressDetailsLovRN Rt.Click New Table Using Wizard Available View Use : AddressDetailsLovVO Region Id : AdressDetailsLovTableRN Address Id Search Allowed : true

2) PaymentTermsLovVO Create Region ( Rt.Click on .jpr and create ) Name : PaymentTermsLovRN Package : supp.oracle.apps.po.create.webui Style : LostOfValues Scope : public AM Defintion : SupplierLovAM Add VO (PaymentTermsLovVO ) to PaymentTermsLovRN Rt.Click New Table Using Wizard Available View Use : PaymentTermsLovVO Region Id : PaymentTermsLovTableRN LookupCode Search Allowed : true

76

Raaj Nagulapalli
M.C.A

3) CarrierCodeLovVO Create Region ( Rt.Click on .jpr and create ) Name : CarrierCodeLovRN Package : supp.oracle.apps.po.create.webui Style : LostOfValues Scope : public AM Defintion : SupplierLovAM Add VO (CarrierCodeLovVO) to CarrierCodeLovRN Rt.Click New Table Using Wizard Available View Use : CarrierCodeLovVO Region Id : CarrierCodeLovTableRN LookupCode Search Allowed : true

14) Attach the above external regions to lov items 1) Address 2) PaymentTerms 3) CarrierCode 1) Column2 ( Address ) Address item Properties : External Lov : /supp/oracle/apps/po/create/webui/AdressDetailsLovRN Lov Map Lov Region Item : AddressId Return Item : Address Criteria Item : Address 2) Column3 (PaymentTerms ) PaymentTerms item Properties : External Lov : /supp/oracle/apps/po/create/webui/PaymentTermsLovRN Lov Map Lov Region Item : LookupCode Return Item : PaymentTerms Criteria Item : PaymentTerms

3) Column4 (CarrierCode ) CarrierCode item Properties : External Lov : /supp/oracle/apps/po/create/webui/CarrierCodeLovRN Lov Map Lov Region Item : LookupCode Return Item : CarrierCode Criteria Item : CarrierCode

77

Raaj Nagulapalli
M.C.A

15) Create VO for PurchaseSiteFlag (Column5 : messageChoice) Create VO inside of package supp.oracle.apps.po.create.poplist.server ( since it is a messageChoice VO not LOV ) Name : PurchaseSiteFlagVO Query : select lookup_code,meaning from FWK_TBX_LOOKUP_CODES_VL where lookup_type = 'FWK_TBX_YES_NO' Shuttle the above VO to AM ( SupplierAM under the .server package but not SuppLovAM)

16) Go to Page and add the PurchaseSiteFlagVO to Choice item PurchaseSiteFlag ( Column5) Properties : Picklist View instance : PurchaseSiteFlagVO Picklist Display Attribute : Meaning Picklist Value Attribute : LookupCode View Attribute : PurchasingSiteFlag

17) Add footer to Advanced table advancedTableComponents footer tableFooter1 Rt.Click addTableRow Properties : AddRowsLable : AddAnotherRow

19) Develop the controller for Adding new Row and Submitting . Name : SupplierCreateCO Code inside the SupplierCreationCO.java

/*===========================================================================+ | Copyright (c) 2001, 2003 Oracle Corporation, Redwood Shores, CA, USA | | All rights reserved. | +===========================================================================+ | HISTORY | +===========================================================================*/ package chand.oracle.apps.po.supp.server.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;

// newly added package import chand.oracle.apps.po.supp.server.SuppAMImpl; import oracle.apps.fnd.framework.webui.OAWebBeanConstants; /**

78

Raaj Nagulapalli
M.C.A

* Controller for ... */ public class SupplierCreationCO 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); // the following is a newly added code SuppAMImpl am = ( SuppAMImpl ) pageContext.getApplicationModule(webBean); am.supplierTableBlankRowLogic(); //the above is newly added code } /** * 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 SuppAMImpl am = ( SuppAMImpl ) pageContext.getApplicationModule(webBean); if(ADD_ROWS_EVENT.equals(pageContext.getParameter(EVENT_PARAM))) { am.siteTableBlankRowLogic(); } if(pageContext.getParameter("Submit")!=null) { am.saveLogic(); } if(pageContext.getParameter("Back")!=null) {

pageContext.setForwardURL("OA.jsp?page=/chand/oracle/apps/po/supp/webui/SupplierCreationPG", null, OAWebBeanConstants.KEEP_MENU_CONTEXT, null,

79

Raaj Nagulapalli
M.C.A

null, false, //RetainAM null, OAWebBeanConstants.IGNORE_MESSAGES); } am.supplierTableBlankRowLogic(); //the above is newly added code

} } The code inside the SuppAMImpl.java

package chand.oracle.apps.po.supp.server; import oracle.apps.fnd.framework.server.OAApplicationModuleImpl; import oracle.jbo.server.ApplicationModuleImpl; import chand.oracle.apps.po.supp.poplist.server.PurchaseSiteFlagVOImpl; // newly added packages import oracle.jbo.Row; import oracle.jbo.domain.Number; import oracle.apps.fnd.framework.OAException; // --------------------------------------------------------------// --- File generated by Oracle Business Components for Java. // ---------------------------------------------------------------

public class SuppAMImpl extends OAApplicationModuleImpl {

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

/** * * Sample main for debugging Business Components code using the tester. */ public static void main(String[] args) { launchTester("chand.oracle.apps.po.supp.server", "SuppAMLocal"); }

/** *

80

Raaj Nagulapalli
M.C.A

* Container's getter for SupplierTableVO */ public SupplierTableVOImpl getSupplierTableVO() { return (SupplierTableVOImpl)findViewObject("SupplierTableVO"); } // the following is a newly added method

public void supplierTableBlankRowLogic() { SupplierTableVOImpl vo = getSupplierTableVO(); Row r = vo.createRow(); if(!vo.isPreparedForExecution()) { vo.executeQuery(); } vo.insertRow(r); r.setNewRowState(Row.STATUS_INITIALIZED); Number a =this.getOADBTransaction().getSequenceValue("fwk_tbx_suppliers_seq"); // // fwk_tbx_suppliers_seq is a sequence in the database. vo.getCurrentRow().setAttribute("SupplierId",a); } // the above is a newly added method /** * Container's getter for SiteTableVO */ public SiteTableVOImpl getSiteTableVO() { return (SiteTableVOImpl)findViewObject("SiteTableVO"); } // the following two methods (siteTableBlankRowLogic and saveLogic ) are newly added methods public void siteTableBlankRowLogic() // { SupplierTableVOImpl vo1= getSupplierTableVO(); SiteTableVOImpl vo = getSiteTableVO(); Row r = vo.createRow(); if(!vo.isPreparedForExecution()) { vo.setMaxFetchSize(0); } vo.insertRow(r); r.setNewRowState(Row.STATUS_INITIALIZED); Number a = this.getOADBTransaction().getSequenceValue("fwk_tbx_supplier_sites_seq"); // fwk_tbx_supplier_sites_seq is sequence in a database. vo.getCurrentRow().setAttribute("SupplierSiteId",a); String b = vo1.getCurrentRow().getAttribute("SupplierId").toString(); vo.getCurrentRow().setAttribute("SupplierId",b); }

81

Raaj Nagulapalli
M.C.A

public void saveLogic() { this.getOADBTransaction().commit(); throw new OAException("Records Saved Successfully",OAException.CONFIRMATION); } // the above two methods are newly added methods /** * * Container's getter for PurchaseSiteFlagVO */ public PurchaseSiteFlagVOImpl getPurchaseSiteFlagVO() { return (PurchaseSiteFlagVOImpl)findViewObject("PurchaseSiteFlagVO"); }

82

Raaj Nagulapalli
M.C.A

Scripts for OAFramework Customization. 1. Upload a Single PG.xml file <JDEV_DIR>\jdevbin\jdev\bin\import <JDEV_DIR>\jdevbin\jdev\myclasses\xxt\oracle\apps\pon\registration\webui\XXTSupplierRegistrationPG.xml -username apps -password apps -dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=<DB_HOST_NAME>)(PORT=<DB_PORT>))(CONNECT_ DATA=(SID=<DB_SID>)))" -rootDir <JDEV_DIR>\jdevbin\jdev\myclasses\ -rootPackage / 2. Upload multiple PG.xml files <JDEV_DIR>/jdevbin/jdev/bin/import <JDEV_DIR>/jdevbin/jdev/myclasses /oracle/apps/xxpo/pdt/ordering/webui rootDir <JDEV_DIR>/jdevbin/jdev/myclasses / -username apps -password <APPS_PASSWORD> -dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=<DB_HOSTNAME>)(PORT=<DB_PORT>))(CONNECT_D ATA=(SID=<DB_SID>)))" -includeSubpackages -jdk13 -mmddir <JDEV_DIR>/jdevbin/jdev/lib/ext/jrad/config/mmd rootPackage / 3. View the PG.xml from the database in TOAD or SQLDeveloper. Begin Jdr_utils.printDocument(/oracle/apps/pon/award/completion/webui/ponCompleteAward2PG); End; 4. To find the personalized file path for a particular PG.xml begin jdr_utils.listCustomizations('/oracle/apps/fnd/framework/navigate/webui/AppsNavigateMobilePG'); end; Will give /oracle/apps/fnd/framework/navigate/webui/customizations/site/0/AppsNavigateMobilePG When the page is personalized at site level. 5. To download the personalized file, first run the above script in SQL, that will display the full path for the personalized file, then run the below command Eg. Begin Jdr_utils.printDocument(/oracle/apps/fnd/framework/navigate/webui/customizations/site/0/AppsNavigateMobilePG); End; Save the file as AppsNavigateMobilePG.xml in the mentioned path and import into database using the above script. 6. To create translations for the personalized page or for a custom page, download the corresponding xlf file for the personalized page or the custom page. Then change the prompts in the destination language and import the page again.

83

Raaj Nagulapalli
M.C.A

Extract XLF file for a particular directory (For arabic language, for a different language, change accordingly). <JDEV_DIR>\jdevbin\jdev\bin\xliffextract /xxt/oracle/apps/pon/registration/webui -includeSubpackages -mmd_dir D:\Jdev1150CU2\jdevbin\jdev\lib\ext\jrad\config\mmd -root D:\Temp\XLIF\registration -xliff_dir D:\Temp\XLIF\registration -source db -username apps -password <APPS_PASSWORD> -dbconnection "(DESCRIPTION= (ADDRESS=(PROTOCOL=tcp)(HOST=<DB_HOSTNAME>)(PORT=<DB_PORT>))(CONNECT_DATA=(SID=<DB_ SID>)))" -languages ar-AE Extract XLF file for a particular file(For arabic language, for a different language, change accordingly). <JDEV_DIR>\jdevbin\jdev\bin\xliffextract /oracle/apps/pon/outcome/creation/webui/customizations/site/0/ponCreatePOPG -root D:\temp -xliff_dir D:\temp mmd_dir <JDEV_HOME>\jdevbin\jdev\lib\ext\jrad\config\mmd\ -source db -username apps -password <APPS_PASSWORD> -dbconnection " (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL= TCP)(HOST = <DB_HOSTNAME>)(PORT = <DB_PORT>)) ) (CONNECT_DATA = (SERVICE_NAME = <DB_SID>) ) )" -languages ar-AE 7. When you have the Substitutions upload the JPX using the following script from the UNIX prompt, java oracle.jrad.tools.xml.importer.JPXImporter $CUST_TOP/TestProject.jpx -username $APPS_NAME -password $APPS_PASSWORD -dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=<DB_HOSTNAME>)(Port=<DB_PORT>)) (CONNECT_DATA=(SID=<DB_SID>)))" 8. To find the personalizations for a particular object or for the whole system or for a particular package. Login with the user who has Functional Administrator responsibility, you search the Object you have substituted (Functional Administrator=>Personalization=>Import/Export). Search with a particular path, Eg. /oracle/apps/icx will give all the personalization under the path. If the the profile option FND: Personalization Document Root Path set properly, the personalization can be exported to the system directly.

************************************* By Raaj Nagulapalli M.C.A rnagulapalli@gmail.com +919492949048

84

Raaj Nagulapalli
M.C.A