Reat Time Project in Oaf

download Reat Time Project in Oaf

of 39

Transcript of Reat Time Project in Oaf

  • 8/10/2019 Reat Time Project in Oaf

    1/39

    How o Capture lov even in oaf:

    If (pageConext.isLovEvent())

    {

    System.out.println(Inside Lov Event);

    String lovInputSourceId = pageContext.getLovInputSourceId();

    //checking which lov event is fired

    /// below EmployeeLovInput is the ID of messagelovinput

    If (EmployeeLovInput.equals(lovInputSourceId))

    {

    //Invokes AM Method

    Am.invokeMethod(setExtraInfo);

    }

    }

    The pageContext.isLovEvent method returns true/fires if the event value is LOV_UPDATE (meaning the

    user selected a value from the LOV modal Window),or LOV_VALIDATE (MEANING THE USER TABBED

    OUT OF THE lov Iinput field on the baASE PAGE).

  • 8/10/2019 Reat Time Project in Oaf

    2/39

    Real time ProjectPROJECT:1

    Create a customer search page as shown and then link to create customer page

  • 8/10/2019 Reat Time Project in Oaf

    3/39

  • 8/10/2019 Reat Time Project in Oaf

    4/39

    Create Header Table

    CREATE TABLE po.xxcustomer_rebate_header( header_id NUMBER

    , contract_number VARCHAR2(80), division VARCHAR2(80), party_name varchar2(100), contact_person VARCHAR2(80), level1_from NUMBER, level1_to NUMBER, level2_from NUMBER, level2_to NUMBER, level3_from NUMBER, level3_to NUMBER, level4_from NUMBER

    , level4_to NUMBER, advertising_rebate NUMBER, freight_deduct NUMBER, cash_discount NUMBER, updated_flag VARCHAR2(3), accrued_flag VARCHAR2(3), creation_date DATE, created_by NUMBER, last_update_date DATE, last_update_login NUMBER, last_updated_by NUMBER

    , commments VARCHAR2(1000), contract_start_date DATE, contract_end_date DATE, contract_expiry_date DATE, delivered_by VARCHAR2(80), received_by VARCHAR2(80), contract_attachment BLOB, bill_to_location varchar2(100), ad_payment_type VARCHAR2(40), ad_payment_period VARCHAR2(40), vr_payment_type VARCHAR2(40)

    , vr_payment_period VARCHAR2(40), paid_flag VARCHAR2(3), file_name VARCHAR2(80) );

    1. Create synonym apps. xxcustomer_rebate_header for po.xxcustomer_rebate_header

    2. Create sequence po. xxcustomer_rebate_header_con_seq start with 10000

    3. Create synonym apps. xxcustomer_rebate_header_con_seq

    for po.xxcustomer_rebate_header_seq

  • 8/10/2019 Reat Time Project in Oaf

    5/39

    4. Create sequence po. xxcustomer_rebate_hdr_seq start with 100

    5. Create synonym apps. xxcustomer_rebate_hdr_seq for po. xxcustomer_rebate_hdr_seq

    Create Line tableCREATE TABLE po.xxcustomer_rebate_line( line_id NUMBER

    , header_id NUMBER, product_code VARCHAR2(80), level1_amt NUMBER, level1_break VARCHAR2(3), level2_amt NUMBER, level2_break VARCHAR2(3), level3_amt NUMBER, level3_break VARCHAR2(3), level4_amt NUMBER, level4_break VARCHAR2(3), creation_date DATE

    , created_by NUMBER, last_update_date DATE, last_update_login NUMBER, last_updated_by NUMBER );

    1.Create synonym apps. xxcustomer_rebate_line_seq for po.xxcustomer_rebate_line_seq

    2. Create sequence po. xxcustomer_rebate_line_seq start with 10

    3.Create synonym apps.xxcustoemr_rebate_lilne_seq for po.xxcustomer_rebate_line_seq

    INSERTDEVELOP SEARCH PAGE Name As: XxcustomerSearch Page

    Step1

    1) Create Page (.jws,.jpr,bc4j,Am,Page,Attacht Am to Page) (window title, Title)

    2) Rt click on Main RN---- New RNStyleMsgCompnent, properties: Row 1, Coloum 3Rt click Msg Compent RNCreate 3 Items

    Item1 - id &prompt: Party Name,Item2 - id &prompt: Division,Item3 - id &prompt: Contract Number,3) Rt click MainRNNewRNStyle ---RowlayoutRNItem1 - id & PromptGo Style: Submit ButtonItem---Style: Spacer Width: 10Item3- Id & PromptClear Style: Submit Button

    Item---Style: Spacer Width: 10Item2 - id & PromptCreate Rebate Style: Submit Button4) Rt click Main RNNew RNStyle: TableItem1 - id &prompt: Party Name, Properties: ViewInstacne & View AttributeItem2 - id &prompt: Division, Properties: ViewInstacne & View AttributeItem3 - id &prompt: Contract Number Properties: ViewInstacne & View Attribute

  • 8/10/2019 Reat Time Project in Oaf

    6/39

    Step-2

    Create VO In. Server for Search Page Name

    as: XxcustomerSearchVO Attach VO to AMBy Using this Query(Select party_name, division, contract_number from po.xxcustomer_rebate_header Where

    party_name like nvl (:1, party_name)

    And division like nvl (:2, division)And contract_number like nvl (:3, contract_number))ignore now

    If you want Deleting the Customer Information from Data Base permanently use the Code

    (We can modify in same XxcustomerSearchVO)

    a. Expand...Schema ServerSend to xxcustomer_rebate_header (Its created for HeaderEO)b. Select Attribute and Suffield like

    -- Party_Name (xxcustomer_rebate_headerEO:Party_Name)-- Division (xxcustomer_rebate_headerEO: Division)-- Contract _Number (xxcustomer_rebate_headerEO: Contract _Number)-- Headerid (xxcustomer_rebate_headerEO: Headerid)

    c. Select QuerySelect xxcustomer_rebate_headerEO. Party _Name,

    xxcustomer_rebate_headerEO. Divisionxxcustomer_rebate_headerEO. Contract _Numberxxcustomer_rebate_headerEO. Headerid

    From xxcustomer_rebate_header xxcustomer_rebate_headerEOWhere xxcustomer_rebate_headerEO.Party _Name like nvl(:1,

    xxcustomer_rebate_headerEO. Party _Name)xxcustomer_rebate_headerEO.Division like nvl(:1,

    xxcustomer_rebate_headerEO. Division)xxcustomer_rebate_headerEO. Contract _Number like nvl(:1,

    xxcustomer_rebate_headerEO. Contract _Number)xxcustomer_rebate_headerEO. Headerid like nvl(:1,

    xxcustomer_rebate_headerEO. Headerid)

    Step-3

    Expand AM NodeDouble click on AMImpl..Javawrite the code

    ( To Mapping the VO Attribute To Regions Items )Import these Statements from Controller (copy & Past)

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

    public int searchparams(OAPageContext pc,OAWebBean wb)

    {String cusname="";String divison="";String contractno="";int flag=0;XXSunCustomerSearchVOImpl vo=getXXSunCustomerSearchVO();

  • 8/10/2019 Reat Time Project in Oaf

    7/39

    if(pc.getParameter("CName")!=null&&!pc.getParameter("CName").equals("")){cusname=pc.getParameter("CName");vo.setWhereClauseParam(0,cusname);flag=1;}else{vo.setWhereClauseParam(0,null);}if(pc.getParameter("Division")!=null&&!pc.getParameter("Division").equals("")){divison=pc.getParameter("Division");vo.setWhereClauseParam(1,divison);flag=2;}else{vo.setWhereClauseParam(1,null);}

    if(pc.getParameter("ContractNumber")!=null&&!pc.getParameter("ContractNumber").equals("")){contractno=pc.getParameter("ContractNumber");vo.setWhereClauseParam(2,contractno);flag=3;

    }else{vo.setWhereClauseParam(2,null);}

    System.out.println("print flag value"+flag);return flag;}

    Step-4

    Create Controller for XxcustomerSearchPageRt Click On Main RNSet New Controller Name As: XXcustomerSearchCOWe have to import one statementxxdel.oracle.apps.po.xxcustomer_rebate_project.server.Xxcustomer_Rebate_projectAMImpl;

    Write this code After Process Form Request

    XXSunCustomerRebatesAMImpl am=(XXSunCustomerRebatesAMImpl)pageContext.getApplicationModule(webBean);if(pageContext.getParameter("Go")!=null)

  • 8/10/2019 Reat Time Project in Oaf

    8/39

    {am.searchparams(pageContext,webBean);am.getXXSunCustomerSearchVO().executeQuery();

    }

  • 8/10/2019 Reat Time Project in Oaf

    9/39

  • 8/10/2019 Reat Time Project in Oaf

    10/39

    Step-7

    If we Want to Create LOVs, Drop Down Lists, Entity Objects - Should Create BC4Js

    Under .jpr

    1) Rt click on .jpr---New Business Component---Bc4j..poplist.servera. Rt Click On poplist.Server New View Object Name As: DivisionVO ---NextNextb. Select Query Select 'IT' division from dualUnionSelect 'Accounting' division from dualUnionSelect 'Finance' division from dual -----Next---Finishc. Attach VO to AM

    2) Rt click on .jpr---New Business Component---Bc4jLov.Server

    Rt Click On poplist.Server New View Object Name As: CustomerNameLOVVO---NextNext Select customer name from RA_customers -----Next---Finish

    Attach VO to AM

    3) Rt click on .jpr---New Business Component---Bc4jSchema. Server

    Create EO forHeaderRt click on...Schema bc4jcreate new Entity Object ---Next--A. Check on synonymB. Copy the Synonym from header table & past into the

    Schma Object: xxcustomer_rebate_header C. Place the cursor on Name field table Name Automatically will generate

    We should end with EONextNextD. Check the Primary Key in Check Box NextE. under Generate Methodchecks the all check boxesNextnextfinish

    Create EO for LineRt click on Schema bc4j create new Entity Object ---Next--

    a. Check on synonymb.Copy the Synonym from header table & past into the

    Schma Object: xxcustomer_rebate_line c.Place the cursor on Name field table Name Automatically will Generate

    We should end with EONextNextd.Check the Primary Key in Check Box Next

    e.Under Generate Mehodwe should check the all check boxesNextNextFinish

    Step-8

    Create VO Based On EO for Header

    Right Click on .Server Bc4j Create VO Name As:Xxcustomer_Rebate_hdrVO ----NextExpand the Schema Node Chose the Header EO and Send the Select page, next Chose the all Columns and Send the Select Page --- Next---Next----Finish.

    Step-9

  • 8/10/2019 Reat Time Project in Oaf

    11/39

    Create VO Based On EO for Line

    Right Click on .Server Bc4j Create VO Name As:Xxcustomer_Rebate_lineVO ----NextExpand the Schema Node Chose the Header EO and Send the Select page, NextChose the all Columns and Send the Select Page --- Next---Next----Finish.

    Develop One Create Page Name As: XxcustomerCreatePage

    Step-5

  • 8/10/2019 Reat Time Project in Oaf

    12/39

    1. Create Page (.jws,.jpr,bc4j,Am,Page,Attacht Am to Page) (window title, Title)

  • 8/10/2019 Reat Time Project in Oaf

    13/39

  • 8/10/2019 Reat Time Project in Oaf

    14/39

    Select XxcustomerCreatePage

    For Header2) Rt click on Main RNNew RN-StyleTable Layout

    Rt click on Table Layout RNNew Row Layout

    Rt click on Row Lay out RNNewCell FormatRt click on Cell Format RNNewRegion Using WizardSelect HeaderVONextRegion Style:Default Double ColumnNextAs per our Requirement Choose the Columns.

    3) Rt click on Row Layout RNNew Cell FormatRt click on Cell Format RNNew-Region Using WizardSelect Header VO Region Style: Default Single Column

  • 8/10/2019 Reat Time Project in Oaf

    15/39

    As per our Requirement Choose the Columns.

    4) Under Cell Format RNSelect Default Single Column RNIn Properties Visual Text: Qualifying Sales ($) LevelsUnder Cell Format RNcreate Item Id & Prompt: Comments

    Properties: Maximum Size: 1000

    Length: 100Height: 3

  • 8/10/2019 Reat Time Project in Oaf

    16/39

    Step-5 Contn..

    Select XxcustomerCreatePage inRegion4 (Default Double Column)Under Region4 Select the Item: Party Name Change Style As: Message lovinputUnder Party Name 1 Region will be createdRT click on RegionNewtable using wizardSelect CustomerNameLOVVONextNextSend the Customer NameNext---Finish

    In Customer Name Properties MappingLov Region item: Customer NameReturn item : Party NameCriteria item : Party Name

    Follow the Same Steps for BilltoLocation

    For Lines

  • 8/10/2019 Reat Time Project in Oaf

    17/39

  • 8/10/2019 Reat Time Project in Oaf

    18/39

  • 8/10/2019 Reat Time Project in Oaf

    19/39

    6) Rt click on Main RNNew RN Style: Page Button BarUnder this RNCreate 3 ItemsItem1---Id & Prompt save Style: Submit ButtonItem2----Style----Spacer

    Item3Id&Prompt Go To Search Style: Submit Button

    Contd. Select XxcustomerCreatePage inRegion4 (Default Double Column)e. under Region4 Select the Item: Division Change Style As: Message Choice

    In Properties Pick list View Instance: DivisionVO (Copy from AM)Pick list Display Attribute: Division (Column Name)

    Pick list Value Attribute: Division (Column Name)

    Step-6In OAF call one Page to another PageUse this Parameters

    (Link B/W Search Page and Create Page)

    Open: XxcustomerSearchCO

    Import one statementimport oracle.apps.fnd.framework.webui.OAWebBeanConstants;Write this code after form Request

    if (pageContext.getParameter("CreateRebate")!=null){pageContext.setForwardURL("OA.jsp?page=/xxdel/oracle/apps/po/xxcustomer_rebate_project

    /webui/Xxcustomer_Rebate_CreatePG",( Here Take the Crate Page URL)

    null,OAWebBeanConstants.KEEP_MENU_CONTEXT,null,null,true, // Retain AMOAWebBeanConstants.ADD_BREAD_CRUMB_NO,OAWebBeanConstants.IGNORE_MESSAGES);

    }

    Step-10

    Create Sequence for the Header Table Write Code in AMImpL..Java

    Expand the AM Node Write the code in AMImpL..JavaImport 3 statements

    import oracle.apps.fnd.framework.server.OADBTransaction;import oracle.jbo.Row;import oracle.jbo.domain.Number;

  • 8/10/2019 Reat Time Project in Oaf

    20/39

    public void customerheader()

    {Xxcustomer_Rebate_hdrVO Impl vo=getXxcustomer_Rebate_hdrVO();OADBTransaction tr=getOADBTransaction();if(!vo.isPreparedForExecution())

    {vo.executeQuery();}Row row=vo.createRow();vo.insertRow(row);Number ctno=tr.getSequenceValue("xxcustomer_rebate_seq");vo.getCurrentRow().setAttribute("ContractNumber", ctno);String hid=tr.getSequenceValue("xxcustomer_rebate_header_seq").toString();vo.getCurrentRow().setAttribute("HeaderId", hid);}

    Step-11

    Create Controller for Create Page Name As: XxcustomerCreateCOTo Generate Sequence for HeaderUder this call the header method from AMImpl

    Import one statementimport xxdel.oracle.apps.po.xxcustomer_rebate_project.server.Xxcustomer_Rebate_projectAMImpl;

    Write the Code in Process RequestXxcustomer_Rebate_projectAMImpl

    am=(Xxcustomer_Rebate_projectAMImpl)pageContext.getApplicationModule(webBean);am.customerheader();

    Step-12

    Create Add Button for Lines

    Select Create Page In Advance Table RNNewFooterRt click on FooterNewAdtableRow

    Properties: Add Rows Lable: Add Another RowRows to Add: 1Insert Rows Automatically: False

    Step-13

    To Create Sequence for Lines, Write the Code in AMIpmL.Java

    public void customerline()

    {

    Xxcustomer_Rebate_lineVO Impl vo= getXxcustomer_Rebate_lineVO();Xxcustomer_Rebate_hdrVO Impl vo1=getXxcustomer_Rebate_hdrVO();OADBTransaction tr=getOADBTransaction();vo.setMaxFetchSize(0);Row row=vo.createRow();vo.insertRow(row);Number lineid=tr.getSequenceValue("xxcustomer_rebate_line_seq");vo.getCurrentRow().setAttribute("LineId",lineid);

  • 8/10/2019 Reat Time Project in Oaf

    21/39

    String headerid=vo1.getCurrentRow().getAttribute("HeaderId").toString();vo.getCurrentRow().setAttribute("HeaderId",headerid);

    }

    Step-15

    In XxcustomerCreatePage after Enter the Customer Information we have to save

    Open XxcustomerCreateCO Write the code After Process Form RequestXxcustomer_Rebate_projectAMImplam=(Xxcustomer_Rebate_projectAMImpl)pageContext.getApplicationModule(webBean);if(pageContext.getParameter("Save")!=null){

    am.getOADBTransaction().commit();throw new OAException ("record saved successfully",OAException.CONFIRMATION);

    }

    Step-14Code for Add Button & Generate Sequence for Lines

    Write the Code inXxcustomerCreateCO

    After Process Form Request

    if(ADD_ROWS_EVENT.equals(pageContext.getParameter(EVENT_PARAM))){am.customerline ();

    }

    Step-16

    Link B/W XxcustomerCreatePageto XxcustomerSearchPage

    Write the code In XxcustomerCreateCO Import one statemet

    import oracle.apps.fnd.framework.webui.OAWebBeanConstants;After Form Requestif(pageContext.getParameter("GoTOSearch")!=null)

    {pageContext.setForwardURL("OA.jsp?page=/xxsun/oracle/apps/po/newrebates/webui/Xxc

    ustomerCreatePage ",null,OAWebBeanConstants.KEEP_MENU_CONTEXT,null,

    null,false, // Retain AMOAWebBeanConstants.ADD_BREAD_CRUMB_NO,OAWebBeanConstants.IGNORE_MESSAGES);

    }

    Step-17

    Develop One Update Page Name As: XxcustomerUpdatePage

  • 8/10/2019 Reat Time Project in Oaf

    22/39

    Follow the Same Steps for Update Page Which is using in XxcustomerCreatePage As per Our Requirements

    Update

    Step-18Select XxcustomerSearchPageIn Table RegionCreate 1 Item Id & Prompt: Edit Style: ImageIn Properties: 1) Image URL: Updateicon-enable.gif (take from path OA-Media)

    2) Action Type: Fire Action (ones create Action Type Event will be Create)3) Event: update(if we want we can change the Event Name)4) Parameters: click here one window will open (it will Pass Value Dynamically)

    Name Value

    Pheaderid (Variable) ${oa. XxcustomerSearchVO1.HeaderId} --- OK(SearchVO-take from AM) (Attribute Name)

    Check VO and add HeaderId**

    Step-19

    Create Controller for XxcustomerUpdatePageName as:XxcustomerUpdateCOFollow the Same Steps where in XxcustomerCreateCO For Update the customer Information write this code inXxcustomerUpdateCO

    In Process request{String headerid=pageContext.getParameter("pheaderid").toString();

    (variable) (Spell variable)String wherecondition="HEADER_ID='"+headerid+"'";

    (DataBaseColumnName)

    am.getXxcustomer_Rebate_hdrVO1().setWhereClause(wherecondition);am.getXxcustomer_Rebate_hdrVO1().executeQuery();am.getXxcustomer_Rebate_lineVO1().setWhereClause(wherecondition);am.getXxcustomer_Rebate_lineVO1().executeQuery();

    }

    DeleteStep-20

    Select XxcustomerSearchPageIn Table RegionCreate 1 Item Id & Prompt: Delete Style: ImageIn Properties: 1) Image URL: deleteicon_enable (take from path OA-Media)

    2) Action Type: Fire Action (ones create Action Type Event will be Create)3) Event: delete(if we want we can change the Event Name)4) Parameters: click here one window will open (it will Pass Value Dynamically)

    Name Value

  • 8/10/2019 Reat Time Project in Oaf

    23/39

    Pdelete (Variable) ${oa. XxcustomerSearchVO1.Headerid} --- OKSearchVO-take from AM) (Attribute Name)

    Step-21

    In AMImpL.Java import this packageimport oracle.jbo.RowSetIterator;

    import oracle.apps.fnd.framework.webui.OADialogPage;import java.util.Hashtable;import java.io.import oracle.apps.fnd.framework.OAViewObject;import xxdel.oracle.apps.po.xxcustomer_rebate_project.server.Xxcustomer_Rebate_projectVORowImpl;

    public void deleteHederslines(String headerId){int programToDelete = Integer.parseInt(headerId);OAViewObject vo = (OAViewObject)getXxcustomer_Rebate_projectVO1();Xxcustomer_Rebate_projectVORowImpl row = null;

    int fetchedRowCount = vo.getFetchedRowCount();RowSetIterator deleteIter = vo.createRowSetIterator("deleteIter");

    if (fetchedRowCount > 0){deleteIter.setRangeStart(0);deleteIter.setRangeSize(fetchedRowCount);for (int i = 0; i < fetchedRowCount; i++){row = (Xxcustomer_Rebate_projectVORowImpl)deleteIter.getRowAtRangeIndex(i);

    Number primaryKey = row.getHeaderId();if (primaryKey.compareTo(programToDelete) == 0){row.remove();getTransaction().commit();break;

    }}

    }deleteIter.closeRowSetIterator();}

    Step-22Create Message in Apps to Handle Exceptions in OAF

    Login into Oracle ApplicationsResponsibility: Application DeveloperNavigation: ApplicationMessageName: XX_CUSTOMER_WARNINGLanguage: USApplication: iSupplier Portal

  • 8/10/2019 Reat Time Project in Oaf

    24/39

    Current Message Text: Are you sure want to delete the Selected Item (save)After creating the Message we have Run Standard Concurrent ProgramConcurrent Program: Generate Message

    Step-23

    Write Code In XxcustomerSearchCO to Delete ContinuousImport this packagesimport oracle.apps.fnd.framework.webui.OADialogPage;import java.io.Serializable;import java.util.Hashtable;

    In Process Form Request

    if ("delete".equals(pageContext.getParameter(EVENT_PARAM))){String HeaderId1= pageContext.getParameter("pdelete");OAException mainMessage = new OAException("pos","XX_CUSTOMER_WARNING");

    OADialogPage dialogPage = new OADialogPage(OAException.WARNING,mainMessage, null, "", "");

    String yes = pageContext.getMessage("AK", "FWK_TBX_T_YES", null);String no = pageContext.getMessage("AK", "FWK_TBX_T_NO", null);

    dialogPage.setOkButtonItemName("DeleteYesButton");

    dialogPage.setOkButtonToPost(true);dialogPage.setNoButtonToPost(true);dialogPage.setPostToCallingPage(true);

    dialogPage.setOkButtonLabel(yes);dialogPage.setNoButtonLabel(no);

    Hashtable formParams = new Hashtable();formParams.put("HeaderId",HeaderId1); // vo atrribute , variable

    dialogPage.setFormParameters(formParams);pageContext.redirectToDialogPage(dialogPage);}

    else if (pageContext.getParameter("DeleteYesButton") != null){

    String HeaderId= pageContext.getParameter("HeaderId");Serializable[] parameters = { HeaderId};am.invokeMethod("deleteHederslines", parameters);

    OAException message = new OAException("pos","XX_DELETE_CONFORMATIONS",null,OAException.CONFIRMATION,null);

    pageContext.putDialogMessage(message);}

  • 8/10/2019 Reat Time Project in Oaf

    25/39

    }

    Deployment from OAF to Oracle Apps

    1) Move all Class files to Java-TopSource Path : E:\OAF\jdevhome\jdev\myclassesDispatch Path : E:\oracle\viscomn\java

    (In Real Time $ Appl-Top & $ Java-Top) 2) Run the xml import Script in Javabin

    In Dos Prompt E:\OAF\jdevbin\jdev\bin (past here below path)importD:\p4141787_11i_GENERIC\jdevhome\jdev\myprojects\xxpa\oracle\apps\po\consumerrebate\webui\ConsumerRebatePG.xml -rootdir D:\p4141787_11i_GENERIC\jdevhome\jdev\myprojects -username apps -password apps -dbconnection"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=tcp)(HOST=apps.ora.com)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=VIS)))"

    (Run same the import script for create page & update page)

    3) Navigate to Oracle AppsIn Application Developer Responsibilitya. Create Function (Nav:ApplicationFunction)

    In Description TabFunction: xxxxxxxxxxxxxxxUserFunctionName:xxxxxxxxxxxxxxxIn Properties TabType: SSWA servlet functionIn web HTMLHTML call:URL of the Search Page (Save & Close)

    b. Create Menu Attach Function to Menu(Place the Menu in Respective ResponisibilityEx: PO:Menu: Purchasing SuperUser GUI)Open Menu In Query Mode Paste the (Res:Menu) where User Name menu

    c. Bounch the Apche Server ( first close all Applictions)Open the Services Rt click on Apche server---Restart

    How to Create LOV in OA Framework pages step by step:

    1) Create the bc4j for LOV.Right click the .jpr create the BC4j for LOV.

    Ex: xxaam.oracle.apps.po.autosearch.lov.server

    2) Under the LOV bc4j, create the LOVVO and LOVAM(this VO and AM called as LOVVO and LOV AM).

    Ex: xxxLOVVO and xxxLOVAM.

    3) Attach that LOVAM to VO.

    Ex:Add xxxLOVVO to xxxLOVAM.

    4) Create the region under jpr, navigation path is -> right click .jpr->New->OAComponenst ->webtier-

    >Region.

    Ex:xxxLOVRN

    5) Dialog Box->In region properties -> style as ListOfValues ->click OK.

    6) In structure window select region ->property inspector ->scopepublic and add LOV AM To this Region.

    7) Come to item search allowed property should be true.

    8) Select the page, which item you want to make LOV and select item style as Message LOV Input.

    9) In property inspector window ->you have to add region path in external LOV.

  • 8/10/2019 Reat Time Project in Oaf

    26/39

    10) Come to mapping section , select map1

    Property inspector ->functional

    LOV Region Itemdata base column Name

    Return Itemregion Item

    Criteria Item- same as return item

    Manual Search Page:

    Manual Search Page:

    Manual Search Page Steps:

    1) Create the page as the normal way like create jws, jpr, bc4js, AM, page etc. .

    2) Create one EO BC4J under that BC4J create EO.->Right click of the BC4J select New Entity Object.

    EX: xxaam.oracle.apps.po.autosearch.schema.server and xxxEO.

    Note : for Manual search no need to create Entity Object. Just for explaining how to create EO based VO.3) Then create VO based on EO. Create new VO under particular(VO) BC4J, there you can shuffle the EO

    (which you created in 2ndstep) into selected side.

    4) Click next twice and query automatically will generate , if you want to change you select expert mode

    checkbox and you can change the query. Amend the where clause like below example.

    Ex: SELECT DepartmentEO.DEPT_ID,

    DepartmentEO.DEPTNO,

    DepartmentEO.DEPTNAME,

    DepartmentEO.LOCATION,

    DepartmentEO.CREATED_BY,

    DepartmentEO.CREATION_DATE,

    DepartmentEO.LAST_UPDATED_BY,DepartmentEO.LAST_UPDATE_DATE,

    DepartmentEO.LAST_UPDATE_LOGIN

    FROM Department DepartmentEO

    WHERE DepartmentEO.DEPTNAME LIKE NVL(:1,DepartmentEO.DEPTNAME)

    AND DepartmentEO.LOCATION LIKE NVL(:2,DepartmentEO.LOCATION)

    5) Then finish the creation VO.

    6) Add this VO into AM.

    7) Then design the page , create 3 regions 1 for getting page items, 2 for getting buttons and, 3 for table

    region for displaying results when you press the go button.

    8) Select AMimpl class file to write logic like below.

    public int deptsearchparams(OAPageContext pageContext, OAWebBean webBean)

    {

    int flag=0;

    String Dname = "";

    http://oraappsframework.blogspot.in/2012/06/manual-search-page.htmlhttp://oraappsframework.blogspot.in/2012/06/manual-search-page.htmlhttp://oraappsframework.blogspot.in/2012/06/manual-search-page.html
  • 8/10/2019 Reat Time Project in Oaf

    27/39

    String Location ="";

    DeptSearchVOImpl vo= getDeptSearchVO1();

    if(pageContext.getParameter("DeptName")!=null && !pageContext.getParameter("DeptName").equals(""))

    {Dname=pageContext.getParameter("DeptName").toString();

    vo.setWhereClauseParam(0,Dname);

    flag=1;

    }

    else

    {

    vo.setWhereClauseParam(0,null);

    }

    if(pageContext.getParameter("Location")!=null && !pageContext.getParameter("Location").equals("")){

    Location=pageContext.getParameter("Location").toString();

    vo.setWhereClauseParam(1,Location);

    flag=2;

    }

    else

    {

    vo.setWhereClauseParam(1,null);

    }

    System.out.println("the flag value is"+flag);return flag;

    }

    9) Create Controller under pageLayouot region to handle the go button events and call the logic from AM.

    Follow logic below.

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

    {

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

    int fg=am. deptsearchparams (pageContext, webBean);

    if(fg==0)

    {

    am.getDepartmentVO1().setWhereClauseParam(0,"-gfdgdjghdj");

    am.getDepartmentVO1().setWhereClauseParam(1,"hkdffhkdkhgkk");

    throw new OAException("please select atleast one search criteria",OAException.ERROR);

  • 8/10/2019 Reat Time Project in Oaf

    28/39

    }

    else

    {

    am.getDepartmentVO1().executeQuery();

    }}

    10) Then run the page to test the Manual search page.

    Validations

    SEACH PAGE VALIDATION (Display the Value after Entering value inSearch Criteria)Public int /**This is Search page Validation*/ ConsumerSearch (OAPageContextpc,OAWebBean wb)

    {int flag = 0; //For search page ValidationString pna=null;String div=null;String ctno=null;XXconsumer_DiscountVOImpl vo=getXXconsumer_DiscountVO1();if(pc.getParameter("PartyName")!=null && !

    pc.getParameter("PartyName").equals("")){pna=pc.getParameter("PartyName").toString();vo.setWhereClauseParam(0,pna);flag =1; //For search page Validation

    }else{

    vo.setWhereClauseParam(0,null);}if(pc.getParameter("Division")!=null && ! pc.getParameter("Division").equals("")){div=pc.getParameter("Division").toString();vo.setWhereClauseParam(1,div);flag=2;//For search page Validation

    }else{

    vo.setWhereClauseParam(1,null);

    http://oraappsframework.blogspot.in/2012/07/validations.htmlhttp://oraappsframework.blogspot.in/2012/07/validations.html
  • 8/10/2019 Reat Time Project in Oaf

    29/39

    }if(pc.getParameter("ContractNumber")!=null && ! pc.getParameter

    ("ContractNumber").equals("")){

    ctno=pc.getParameter("ContractNumber").toString();

    vo.setWhereClauseParam(2,ctno);flag=3;//For search page Validation}else{

    vo.setWhereClauseParam(2,null);}

    return flag;//For search page Validation}

    IN Search CO (ProcessFormRequest) Write the code after B/T Go & Commitif(pageContext.getParameter("Go")!=null)

    {int flag=am.ConsumerSearch(pageContext,webBean);if(flag==0){am.getXXconsumer_DiscountVO1().setWhereClauseParam(0,"asdf");am.getXXconsumer_DiscountVO1().setWhereClauseParam(1,"lkjh");am.getXXconsumer_DiscountVO1().setWhereClauseParam(1,"qwer");throw new OAException("plz entry any value in search

    criteria",OAException.ERROR);}

    else{am.getXXconsumer_DiscountVO1().executeQuery();

    } }

    COMPARE TWO DAYS(Validation on Start Date & End Date)In Create CO (ProcessFormRequest) Write the code b/t the save and commit

    import.java.util.Date;String startdate=pageContext.getParameter("ContractStartDate");String enddate=pageContext.getParameter("ContractEndDate");if((null!=startdate)&&(null!=enddate)){Date sdate=new Date(startdate);

    Date edate=new Date(enddate);if(edate.getTime()

  • 8/10/2019 Reat Time Project in Oaf

    30/39

    COMPARE TWO NUMBER(Validation on Levels to Greater than one asanother)In Create CO (ProcessFormRequest) Write the code b/t save and commitimport.oracle.jbo.domain.Number;

    String slevel1=pageContext.getParameter("Level1From");

    String slevel2=pageContext.getParameter("Level1To");Number nlevel1=null;Number nlevel2=null;try{nlevel1 = new Number (slevel1);nlevel2 = new Number (slevel2);

    }catch (Exception e){e.printStackTrace();

    }if((null!=slevel1)&&(null!=slevel2)){if(nlevel1.intValue() > nlevel2.intValue())

    {throw new OAException("level2 is greater than level1",OAException.ERROR);}}

    DISPLAY CAPTER LETERS ON FIELD(validation on BillToLocation)In Create CO (ProcessRequest)import oracle.cabo.style.CSSStyle;

    import oracle.apps.fnd.framework.webui.beans.message.OAMessageLovInputBean;CSSStyle css=new CSSStyle();css.setProperty("text-transform","uppercase");OAMessageLovInputBean

    mti=(OAMessageLovInputBean)webBean.findChildRecursive("BillToLocation");

    if(mti!=null){mti.setInlineStyle(css);

    }

    CHANGE THE COLORS OF THE LETTERS(Validation on BillToLocation)

    In Create CO (ProcessRequest)import oracle.cabo.style.CSSStyle;CSSStyle css=new CSSStyle();css.setProperty("color","#ff0000");// THIS FOR COLORS OF THE FIEDOAMessageLovInputBean mti=(OAMessageLovInputBean)webBean.

    findChildRecursive("BillToLocation");if(mti!=null){

  • 8/10/2019 Reat Time Project in Oaf

    31/39

    mti.setInlineStyle(css);}

    SPECIAL CHARACTERS ARE NOT ALLOWED ON A FIELD(validation OnPartyName)In Create CO (ProcessFormRequest) Write the code b/t save and commit

    String cname=pageContext.getParameter("PartyName");Pattern p=Pattern.compile("[^a-zA-Z0-9\\s]");Matcher m=p.matcher(cname);if(m.find()){throw new OAException("Special Characters are not

    allowed",OAException.ERROR);}

    FRIEGHT DEDUCTION FIELD SHOULD NOT ALLOW MORE THAN 100 (Validation on Freight Deduction)

    In Create PG Select Freight Deduction item

    In Properties Action Type: FirepartialActionevent: firepartial (here we can give any name)

    In Create CO (ProcessFormRequest)if("firepartial".equals(pageContext.getParameter(EVENT_PARAM)))

    {String fright=pageContext.getParameter("FreightDeduct");Number frighting=null;try{frighting=new Number(fright);

    }

    catch (Exception e){e.printStackTrace();

    }if((null!=fright))//&&(null!=fright)){if((frighting.intValue()=100))// if((frighting.intValue()100)){

    throw new OAException("frieght deduction should not allow more then 100", OAException.ERROR);

    }}

    DEPENDENT LOV (Validation on PartyName & BillToLocation)CREATE 2 VO'S& VO's to AM1.CUSTOMERVO (QUERY)

    SELECThp.party_name,hp.party_id,

  • 8/10/2019 Reat Time Project in Oaf

    32/39

    hp.party_numberFROM

    hz_parties hpWHERE

    EXISTS (SELECT HCAS.CUST_ACCOUNT_ID,HCAS.PARTY_SITE_ID,

    HPS.PARTY_IDFROM hz_cust_acct_sites_all HCAS, HZ_PARTY_SITES HPSWHERE HPS.PARTY_SITE_ID = HCAS.PARTY_SITE_ID ANDHP.PARTY_ID = HPS.PARTY_ID ANDHP.STATUS 'M')

    ORDER BY HP.PARTY_NAME2. LOCATIONVO (QUERY)

    SELECThzsu.site_use_id,hzl.address1||DECODE(hzl.address2,NULL,NULL,','||hzl.address2)||

    ','||hzl.city||','||hzl.country||','||hzl.postal_code LOCATION,

    hp.party_idFROMhz_parties hp,

    hz_cust_accounts hza,hz_cust_acct_sites_all hzas,hz_cust_site_uses_all hzsu,hz_party_sites hzps,hz_locations hzl

    WHEREhza.party_id = hp.party_id

    AND hzas.cust_account_id = hza.cust_account_idAND hzps.party_site_id = hzas.party_site_idAND hzl.location_id = hzps.location_idAND hzsu.site_use_code = 'BILL_TO'AND hzsu.cust_acct_site_id = hzas.cust_acct_site_idAND hzsu.org_id = hzas.org_idCreate one item under DefaultDebouleRegion

    Item Style: Form Value ID& Prompt: LinkidCreate one more Mapping under PartyName

    In Properties: LOV Region Item: PartyIdReturn Item: Linkid

    Create one more Mapping under BillToLocationIn Properties: LOV Region Item: PartyId

    Criteria item: Linkid

    DEPENDENT POPLISTCreate 2 VO's Under POP List..Server & Attach VO's To AM 1. DNameVO: SELECT DNAME FROM SCOTT.DEPT2. ENameVO: SELECT ENAME, DNAME FROM SCOTT.EMP E, SCOTT.DEPT DWHERE

  • 8/10/2019 Reat Time Project in Oaf

    33/39

  • 8/10/2019 Reat Time Project in Oaf

    34/39

    findChildRecursive("ADVERTISING_REBATE");if(mst!=null)

    {mst.setCurrencyCode("USD");

    }

    EXPORTING DATE TO EXCELL SHEETIn Search PGCreate Item under RowLoyoutRegion

    Item Id & Prompt: Export Style: export ButtonIn properties: View Instance: SearchVO

    MESSAGE FILE UPLOADBEAN(Validation on Attachment Column)IN Create PG

    Attachment Data Type: Make sure=BLOBif want display the file Name on the field write below codeInprocessRequestimport oracle.apps.fnd.framework.webui.beans.message.OAMessageFileUploadBean;import oracle.apps.fnd.framework.webui.OADataBoundValueViewObject;

    OAMessageFileUploadBean upload=(OAMessageFileUploadBean)webBean.findChildRecursive("ContractAttachment");

    OADataBoundValueViewObject displaybound=new OADataBoundValueViewObject

    (upload,"FileName");upload.setAttributeValue(DOWNLOAD_FILE_NAME,displaybound);

    Update Page & Delete Page in OA Framework:

    Update Page in OA Framework:

    Update Page Steps:

    1) Create the page as the normal way like create jws, jpr, bc4js, AM, page etc. . 2) EO should be mandatory to develop the update page.3) Create the EO which table you want to update the records through page.4) Create the BC4J for EO and develop the EO.

    Ex: xxaam.oracle.apps.po.autosearch.schema.server and xxxEO.5) Then create VO based on EO. Create a new VO under particular(VO) BC4J, there you can Shuffle the

    EO (which you created in 2ndstep) into selected side6) Add above VO into AM.7) Select the search page, there select table region and create one item and style as image.8) In the image properties a) image uri as updateicon_enabled.gif b)Action Type as fire action. In the

    parameter window -> id = pdeptid value -> ${oa.SearchVO1.DeptId}.

    http://oraappsframework.blogspot.in/2012/06/update-page-in-oa-framework.htmlhttp://oraappsframework.blogspot.in/2012/06/update-page-in-oa-framework.htmlhttp://oraappsframework.blogspot.in/2012/06/update-page-in-oa-framework.html
  • 8/10/2019 Reat Time Project in Oaf

    35/39

    9) Create the update page with appropriate records. And Buttons.10) Create Controller under pageLayouot region to handle the go button events and call the logic from AM.

    Follow logic below.

    Process request:

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

    String deptid=pageContext.getParameter("pdeptid").toString();String whereclause="DEPT_ID='"+deptid+"'";am.getCreateVO1().setWhereClauseParams(null);am.getCreateVO1().setWhereClause(whereclause);am.getCreateVO1().executeQuery();

    }

    Process Form request:

    If (pageContext.getParameter("Save")!=null){am.getOADBTransaction().commit();

    }

    Create the table and synonym example:

    Create table modpos.DEPARTMENT(DEPT_ID number PRIMARY KEY,DEPTNO VARCHAR2(50),

    DEPTNAME VARCHAR2(100),LOCATION VARCHAR2(100),CREATED_BY NUMBER,

    CREATION_DATE Date,

    LAST_UPDATED_BY NUMBER,LAST_UPDATE_DATE Date,LAST_UPDATE_LOGIN NUMBER)

    CREATE SYNONYM DEPARTMENT FOR modpos.DEPARTMENT

  • 8/10/2019 Reat Time Project in Oaf

    36/39

    Create the Sequene with example:

    create sequence DEPT_DEPT_ID_SEQStart with 1 increment by 1Grant all on DEPT_DEPT_ID_SEQ to appscreate sequence DEPT_DEPT_ID_SEQStart with 4 increment by 1 cus

    Grant all on DEPT_DEPT_ID_SEQ to apps cus

    Create synonym DEPT_DEPT_ID_SEQ for cus.DEPT_DEPT_ID_SEQ apps

    Call one OAF page from another OAF page Syntax:

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

    pageContext.setForwardURL("OA.jsp?page=rajesh/oracle/apps/po/dept/webui/DepartmentCreationPage",

    null,OAWebBeanConstants.KEEP_MENU_CONTEXT,null,null,false, // Retain AMOAWebBeanConstants.ADD_BREAD_CRUMB_NO, // Do not display breadcrumsOAWebBeanConstants.IGNORE_MESSAGES);

    }

    Follow Bc4j for each object:

    AM AND VO -> BC4JXXAAM.oracle.apps.po.xxname.server Entity Object(EO) -> BC4JXXAAM.oracle.apps.po.xxname.schema.server LOV ->BC4JXXAAM.oracle.apps.po.xxname.LOV.server Poplist ->BC4JXXAAM.oracle.apps.po.xxname.poplist.server Controller,Page & RegionXXAAM.oracle.apps.po.xxname.webui

    Delete page steps

    1) For delete no need to create any pages.2) Select search page , in table region you create one item and style as image. Below set of

    properties needs to set for this image.

    Image Uri - deleteicon_enabled.gifAction Type fireActionEvent - Any Name (delete)

  • 8/10/2019 Reat Time Project in Oaf

    37/39

    Parameter window:SPEL

    NameDeptIdValue - ${oa.SearchVO1.DeptId}

    3) write the delete login AM, start with creating method ->

    public void deletedepartment(String departmentid){// First, we need to find the selected Program in our VO.// When we find it, we call remove( ) on the row which in turn// calls remove on the associated ModposVendorProgsImpl object.

    int deptidtodelete=Integer.parseInt(departmentid);

    SearchVOImpl vo=getSearchVO1();

    SearchVORowImpl row=null;// This tells us the number of rows that have been fetched in the

    // row set, and will not pull additional rows in like some of the

    // other "get count" methods.

    int fetchedrowcount =vo.getFetchedRowCount();System.out.println("Fetched Row Count is"+fetchedrowcount);// We use a separate iterator -- even though we could step through the

    // rows without it -- because we don't want to affect row currency.RowSetIterator deleteiter=vo.createRowSetIterator("deleteiter");

    if (fetchedrowcount >0){deleteiter.setRangeStart(0);deleteiter.setRangeSize(fetchedrowcount);

    for (int i=0;i

  • 8/10/2019 Reat Time Project in Oaf

    38/39

    if ("delete".equals(pageContext.getParameter(EVENT_PARAM)))

    {// The user has clicked a "Delete" icon so we want to display a "Warning"// dialog asking if she really wants to delete the employee. Note that we// configure the dialog so that pressing the "Yes" button submits to// this page so we can handle the action in this processFormRequest( ) method.

    String DeptId = pageContext.getParameter("DeptId");

    OAException mainMessage = new OAException("POS","xxx");// Note that even though we're going to make our Yes/No buttons submit a

    // form, we still need some non-null value in the constructor's Yes/No// URL parameters for the buttons to render, so we just pass empty// Strings for this.

    OADialogPage dialogPage = new OADialogPage(OAException.WARNING,mainMessage, null, "", "");// Always use Message Dictionary for any Strings you want to display.String yes = pageContext.getMessage("AK", "FWK_TBX_T_YES", null);String no = pageContext.getMessage("AK", "FWK_TBX_T_NO", null);

    // We set this value so the code that handles this button press is// descriptive.dialogPage.setOkButtonItemName("DeleteYesButton");// The following configures the Yes/No buttons to be submit buttons,

    // and makes sure that we handle the form submit in the originating// page (the "Employee" summary) so we can handle the "Yes"// button selection in this controller.

    dialogPage.setOkButtonToPost(true);dialogPage.setNoButtonToPost(true);dialogPage.setPostToCallingPage(true);// Now set our Yes/No labels instead of the default OK/Cancel.dialogPage.setOkButtonLabel(yes);

    dialogPage.setNoButtonLabel(no);// The OADialogPage gives us a convenient means

    // of doing this. Note that the use of the Hashtable is// most appropriate for passing multiple parameters. See the OADialogPage// javadoc for an alternative when dealing with a single parameter.Hashtable formParams = new Hashtable();

    formParams.put("DeptId", DeptId);

    dialogPage.setFormParameters(formParams);

    pageContext.redirectToDialogPage(dialogPage);

    }else if (pageContext.getParameter("DeleteYesButton") != null){// User has confirmed that she wants to delete this employee.// Invoke a method on the AM to set the current row in the VO and// call remove() on this row.String DeptId = pageContext.getParameter("DeptId");

    Serializable[] parameters = { DeptId };// OAApplicationModule am = pageContext.getApplicationModule(webBean);

  • 8/10/2019 Reat Time Project in Oaf

    39/39

    am.invokeMethod("deletedepartment", parameters);

    // Now, redisplay the page with a confirmation message at the top. Note// that the deleteComponent() method in the AM commits, and our code// won't get this far if any exceptions are thrown.

    OAException message = new OAException("POS","xxxxxxxx",null,OAException.CONFIRMATION,null);

    pageContext.putDialogMessage(message);

    }}

    Emp advance table row

    public void createemp(){

    EmployeeCreationVOImpl vo= getEmployeeCreationVO1();DepartmentCreationVOImpl vo1= getDepartmentCreationVO1();

    OADBTransaction tr=getOADBTransaction();

    vo.setMaxFetchSize(0);

    Row row1=vo.createRow();vo.insertRow(row1);

    row1.setNewRowState(Row.STATUS_INITIALIZED);Number empid=tr.getSequenceValue("EMPLOEE_EMP_ID_SEQ");vo.getCurrentRow().setAttribute("EmployeeId",empid);String departmentid=vo1.getCurrentRow().getAttribute("DeptId").toString();

    vo.getCurrentRow().setAttribute("DeptId",departmentid);

    }

    if (ADD_ROWS_EVENT.equals(pageContext.getParameter(EVENT_PARAM))){am.invokeMethod("createemp");

    }Posted byAmresh at2:37 AM1 c

    http://www.blogger.com/profile/17654673261752762950http://www.blogger.com/profile/17654673261752762950http://www.blogger.com/profile/17654673261752762950http://oraappsframework.blogspot.in/2012/06/update-page-in-oa-framework.htmlhttp://oraappsframework.blogspot.in/2012/06/update-page-in-oa-framework.htmlhttp://oraappsframework.blogspot.in/2012/06/update-page-in-oa-framework.html#comment-formhttp://oraappsframework.blogspot.in/2012/06/update-page-in-oa-framework.html#comment-formhttp://oraappsframework.blogspot.in/2012/06/update-page-in-oa-framework.html#comment-formhttp://oraappsframework.blogspot.in/2012/06/update-page-in-oa-framework.html#comment-formhttp://oraappsframework.blogspot.in/2012/06/update-page-in-oa-framework.htmlhttp://www.blogger.com/profile/17654673261752762950