Wednesday, July 11, 2012

Real time Project

PROJECT:1

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




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
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 table  
    CREATE 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
               
INSERT
DEVELOP 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 RN— Style—MsgCompnent, properties: Row 1, Coloum 3
   Rt click Msg Compent RN—Create 3 Items
Item1 -   id &prompt: Party Name,
Item2 -   id &prompt: Division,
Item3 -   id &prompt: Contract Number,
3) Rt click MainRN –NewRN –Style ---RowlayoutRN
Item1 - id & Prompt—Go                     Style: Submit Button
Item---Style: Spacer               Width: 10
Item3-   Id & Prompt –Clear           Style: Submit Button
Item---Style: Spacer               Width: 10
Item2 - id & Prompt—Create Rebate    Style: Submit Button
4) Rt click Main RN –New RN—Style: Table
Item1 -   id &prompt: Party Name,          Properties: ViewInstacne & View Attribute     
Item2 -   id &prompt: Division,         Properties: ViewInstacne & View Attribute     
Item3 -   id &prompt: Contract Number Properties: ViewInstacne & View Attribute     
Step-2
Create VO In. Server for Search Page Name as: XxcustomerSearchVO                               Attach VO to AM—By 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 Server – Send to xxcustomer_rebate_header (It’s  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 Query
  Select xxcustomer_rebate_headerEO. Party _Name,
             xxcustomer_rebate_headerEO. Division
             xxcustomer_rebate_headerEO. Contract _Number
             xxcustomer_rebate_headerEO. Headerid
  From  xxcustomer_rebate_header xxcustomer_rebate_headerEO
 Where 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 Node –Double click on AMImpl..Java –write 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();

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 XxcustomerSearchPage  
Rt Click On Main RN –Set New Controller   Name As: XXcustomerSearchCO
We have to import one statement
xxdel.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)
   {
     am.searchparams(pageContext,webBean);
     am.getXXSunCustomerSearchVO().executeQuery();
   }




Step-7
If we Want to Create LOV’s, Drop Down List’s, Entity Object’s - Should Create BC4J’s
Under .jpr  
1) Rt click on .jpr---New Business Component ---Bc4j…..poplist.server    
  a. Rt Click On …poplist.Server –New View Object  Name As: DivisionVO ---Next—Next
  b. Select Query   Select 'IT' division from dual
  Union
  Select 'Accounting' division from dual
  Union
  Select 'Finance' division from dual   -----Next---Finish
  c. Attach VO to AM


 
2) Rt click on .jpr---New Business Component---Bc4j…Lov.Server
  Rt Click On …poplist.Server –New View Object Name As: CustomerNameLOVVO
     ---Next—Next     Select customer name from RA_customers -----Next---Finish
  Attach VO to AM
  
3) Rt click on .jpr---New Business Component---Bc4j…Schema. Server
   Create EO for Header
   Rt click on...Schema bc4j –create new Entity Object ---Next--
     A. Check on synonym
     B. 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    EO—Next—Next
     D. Check the Primary Key in Check Box Next
     E. under Generate Method— checks the all check boxes –Next—next—finish
  Create EO   for Line
  Rt click on …Schema bc4j –create new Entity Object  ---Next--
     a. Check on synonym
     b.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    EO—Next—Next
     d.Check the Primary Key in Check Box  Next
     e.Under Generate Mehod—we should check the all check boxes –Next—Next—Finish

Step-8
Create VO Based On EO for Header  
Right Click on ….Server Bc4j Create VO Name As:Xxcustomer_Rebate_hdrVO  ----Next
Expand 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
Create VO Based On EO for Line
Right Click on ….Server Bc4j Create VO Name As: Xxcustomer_Rebate_lineVO ----Next
Expand 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.




Develop One Create Page Name As: XxcustomerCreatePage


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


 Select XxcustomerCreatePage
For Header
   2) Rt click on Main RN –New RN-Style—Table Layout
       Rt click on Table Layout RN—New Row Layout
       Rt click on Row Lay out RN—New—Cell Format
       Rt click on Cell Format RN—New—Region Using Wizard
       Select HeaderVO—Next—Region Style: Default Double Column—Next
       As per our Requirement Choose the Columns.




  3) Rt click on Row Layout RN—New Cell Format
      Rt click on Cell Format RN—New-Region Using Wizard
      Select Header VO Region Style: Default Single Column
 As per our Requirement Choose the Columns.

                  

4) Under Cell Format RN—Select Default Single Column RN
   In Properties Visual Text: Qualifying Sales ($) Levels
   Under Cell Format RN –create Item Id & Prompt: Comments
                     Properties: Maximum Size: 1000
                     Length: 100
                      Height: 3

Step-5 Contn………………..
Select XxcustomerCreatePage   in Region4 (Default Double Column)
  Under Region4 Select the Item: Party Name Change Style As: Message lovinput
  Under Party Name 1 Region will be created
  RT click on Region—New—table using wizard—Select CustomerNameLOVVO—Next
  Next—Send the Customer Name –Next---Finish
  In Customer Name Properties Mapping
        Lov Region item: Customer Name
        Return item       : Party Name
        Criteria item       : Party Name
           Follow the Same Steps for BilltoLocation


For Lines
5) Rt click Main RN –New RN Style: Advance Table   View Instant: Select Line VO
   Rt click on Advance Table RN—New—Column
   Rt click on Column—New—Item                 properties: View Attribute
   Rt click on Column Header—New---Sort able Header     Create Prompt
    (Create more Columns, Items & Column Headers for Rest of Things)

     6) Rt click on Main RN—New RN Style: Page Button Bar
         Under this RN—Create 3 Items
         Item1---Id & Prompt             save                      Style: Submit Button
         Item2----Style----Spacer
        Item3—Id&Prompt         Go To Search           Style: Submit Button




Contd. Select XxcustomerCreatePage   in Region4 (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-6   
In OAF call one Page to another Page – Use this Parameters  
(Link B/W Search Page and Create Page)
Open: XxcustomerSearchCO
Import one statement
   import 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 AM
                         OAWebBeanConstants.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..Java
Import 3 statements
       import oracle.apps.fnd.framework.server.OADBTransaction;
       import oracle.jbo.Row;
      import oracle.jbo.domain.Number;

public void customerheader()
 {
  Xxcustomer_Rebate_hdrVO Impl vo=get Xxcustomer_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: XxcustomerCreateCO
To Generate Sequence for Header
Uder this call the header method from AMImpl
    Import one statement
import xxdel.oracle.apps.po.xxcustomer_rebate_project.server.
Xxcustomer_Rebate_projectAMImpl;
Write the Code in Process Request
   Xxcustomer_Rebate_projectAMImpl am=(Xxcustomer_Rebate_projectAMImpl)pageContext.getApplicationModule(webBean);
   am.customerheader();
 

Step-12
Create Add Button for Lines
Select Create Page In Advance Table RN—New—Footer
Rt click on Footer—New—AdtableRow  
    Properties: Add Rows Lable: Add Another Row
              Rows to Add: 1
              Insert Rows Automatically: False
Step-13
To Create Sequence for Lines, Write the Code in AMIpmL.Java
public void customerline()
  {
    Xxcustomer_Rebate_lineVO Impl vo= get Xxcustomer_Rebate_lineVO ();
    Xxcustomer_Rebate_hdrVO Impl  vo1=get Xxcustomer_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);
    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 Request
Xxcustomer_Rebate_projectAMImpl am=(Xxcustomer_Rebate_projectAMImpl)pageContext.getApplicationModule(webBean);
  if(pageContext.getParameter("Save")!=null)
 {
     am.getOADBTransaction().commit();
     throw new OAException ("record saved successfully",OAException.CONFIRMATION);
   }


Step-14
Code for Add Button & Generate Sequence for Lines
Write the Code in XxcustomerCreateCO
After Process Form Request
 if(ADD_ROWS_EVENT.equals(pageContext.getParameter(EVENT_PARAM)))
   {
     am.customerline ();
   }

Step-16
Link B/W XxcustomerCreatePage to XxcustomerSearchPage
Write the code In XxcustomerCreateCO
 Import one statemet
import oracle.apps.fnd.framework.webui.OAWebBeanConstants;
After Form Request
if(pageContext.getParameter("GoTOSearch")!=null)
    {
       pageContext.setForwardURL("OA.jsp?page=/xxsun/oracle/apps/po/newrebates/webui/ XxcustomerCreatePage ",
                              null,
                              OAWebBeanConstants.KEEP_MENU_CONTEXT,
                              null,
                              null,
                              false, // Retain AM
                             OAWebBeanConstants.ADD_BREAD_CRUMB_NO,
                              OAWebBeanConstants.IGNORE_MESSAGES);
    }

Step-17
Develop One Update Page Name As: XxcustomerUpdatePage
Follow the Same Steps for Update Page Which is using in XxcustomerCreatePage
As per Our Requirements


Update
Step-18
Select XxcustomerSearchPage  
In Table Region—Create 1 Item      Id & Prompt: Edit    Style: Image
In 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 XxcustomerUpdatePage Name as: XxcustomerUpdateCO
Follow the Same Steps where in XxcustomerCreateCO
For Update the customer Information write this code in XxcustomerUpdateCO

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




Delete
Step-20
Select XxcustomerSearchPage  
In Table Region—Create 1 Item      Id & Prompt: Delete        Style: Image
In 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
Pdelete (Variable)                ${oa. XxcustomerSearchVO1.Headerid}      --- OK
                              SearchVO-take from AM) (Attribute Name)
Step-21
In AMImpL.Java    import this package
import 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-22
Create Message in Apps to Handle Exceptions in OAF
Login into Oracle Applications
Responsibility: Application Developer
Navigation: Application—Message
Name: XX_CUSTOMER_WARNING
Language: US
Application: iSupplier Portal
Current Message Text: Are you sure want to delete the Selected Item (save)
After creating the Message we have Run Standard Concurrent Program
Concurrent Program: Generate Message

Step-23
Write Code In XxcustomerSearchCO to Delete Continuous  
Import this packages
import 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);
  }
}
Deployment from OAF to Oracle Apps

1) Move all Class files to Java-Top
   Source Path     :    E:\OAF\jdevhome\jdev\myclasses
   Dispatch 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)
import D:\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 Apps – In Application Developer Responsibility
   a. Create Function (Nav:Application—Function)
       In Description Tab
       Function: xxxxxxxxxxxxxxx
       UserFunctionName:xxxxxxxxxxxxxxx
       In Properties Tab
       Type: SSWA servlet function     
       In web HTML
       HTML call:URL of the Search Page   (Save & Close)
   b. Create Menu Attach Function to Menu
       (Place the Menu in Respective Responisibility
        Ex: 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

No comments:

Post a Comment