This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
pageContext.getApplicationModule(webBean).getOADBTransaction().getJdbcConnection(); String Query = "select nvl((SELECT approval_status from apps.XX_SAMPLE_TABLE" + " where objective_id=:1),'Approved') status from dual"; PreparedStatement stmt = conn.prepareStatement(Query); stmt.setInt(1, objectiveId); for (ResultSet resultset = stmt.executeQuery(); resultset.next(); ) { pageContext.writeDiagnostics(this, "Query Executed", 1); String result = resultset.getString("status");//Get the result of the query and store in the string result } } catch (Exception exception) { throw new OAException("Error in Staffing Query" + exception, OAException.ERROR); }
}catch(SQLException sqle) { throw new OAException("Exception Block"+sqle); }
Real time Project OAF
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_header2. Create sequence po. xxcustomer_rebate_header_con_seq start with 100003. Create synonym apps. xxcustomer_rebate_header_con_seq
for po.xxcustomer_rebate_header_seq4. Create sequence po. xxcustomer_rebate_hdr_seq start with 1005. Create synonym apps. xxcustomer_rebate_hdr_seq for po. xxcustomer_rebate_hdr_seqCreate 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_seq2. Create sequence po. xxcustomer_rebate_line_seq start with 103.Create synonym apps.xxcustoemr_rebate_lilne_seq for po.xxcustomer_rebate_line_seq
INSERTDEVELOP SEARCH PAGE Name As: XxcustomerSearch PageStep1
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 ItemsItem1 - id &prompt: Party Name,Item2 - id &prompt: Division,Item3 - id &prompt: Contract Number,3) Rt click MainRN –NewRN –Style ---RowlayoutRNItem1 - id & Prompt—Go Style: Submit ButtonItem---Style: Spacer Width: 10Item3- Id & Prompt –Clear Style: Submit ButtonItem---Style: Spacer Width: 10Item2 - id & Prompt—Create Rebate Style: Submit Button4) Rt click Main RN –New RN—Style: TableItem1 - 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-2Create 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)
System.out.println("print flag value"+flag);return flag;}
Step-4Create Controller for XxcustomerSearchPage Rt Click On Main RN –Set 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 RequestXXSunCustomerRebatesAMImpl am=(XXSunCustomerRebatesAMImpl) pageContext.getApplicationModule(webBean); if(pageContext.getParameter("Go")!=null) { am.searchparams(pageContext,webBean); am.getXXSunCustomerSearchVO().executeQuery(); }
Step-7If we Want to Create LOV’s, Drop Down List’s, Entity Object’s - Should Create BC4J’sUnder .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-8Create 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, nextChose the all Columns and Send the Select Page --- Next---Next----Finish.Step-9Create VO Based On EO for LineRight 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, NextChose 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 inRegion4 (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 Lines5) 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 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-6 In OAF call one Page to another Page – Use this Parameters
(Link B/W Search Page and Create Page)Open: XxcustomerSearchCOImport 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
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-11Create 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 Request Xxcustomer_Rebate_projectAMImpl am=(Xxcustomer_Rebate_projectAMImpl)pageContext.getApplicationModule(webBean); am.customerheader();
Step-12Create Add Button for LinesSelect Create Page In Advance Table RN—New—FooterRt click on Footer—New—AdtableRow Properties: Add Rows Lable: Add Another Row Rows to Add: 1 Insert Rows Automatically: FalseStep-13To Create Sequence for Lines, Write the Code in AMIpmL.Javapublic 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-15In XxcustomerCreatePage after Enter the Customer Information we have to saveOpen XxcustomerCreateCOWrite the code After Process Form RequestXxcustomer_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-14Code for Add Button & Generate Sequence for Lines Write the Code inXxcustomerCreateCOAfter Process Form Request if(ADD_ROWS_EVENT.equals(pageContext.getParameter(EVENT_PARAM))) { am.customerline (); }
Step-16Link B/W XxcustomerCreatePage to XxcustomerSearchPageWrite the code In XxcustomerCreateCO Import one statemetimport oracle.apps.fnd.framework.webui.OAWebBeanConstants;After Form Requestif(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-17Develop One Update Page Name As: XxcustomerUpdatePageFollow the Same Steps for Update Page Which is using in XxcustomerCreatePageAs per Our Requirements
UpdateStep-18Select XxcustomerSearchPage In Table Region—Create 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 ValuePheaderid (Variable) ${oa. XxcustomerSearchVO1.HeaderId} --- OK (SearchVO-take from AM) (Attribute Name)
Check VO and add HeaderId **Step-19Create Controller for XxcustomerUpdatePage Name as: XxcustomerUpdateCO Follow the Same Steps where in XxcustomerCreateCOFor 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-20Select XxcustomerSearchPage In Table Region—Create 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 ValuePdelete (Variable) ${oa. XxcustomerSearchVO1.Headerid} --- OK SearchVO-take from AM) (Attribute Name)Step-21In 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;
Create Message in Apps to Handle Exceptions in OAFLogin into Oracle Applications
Responsibility: Application Developer Navigation: Application—MessageName: XX_CUSTOMER_WARNING Language: USApplication: iSupplier PortalCurrent 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-23Write Code In XxcustomerSearchCOto Delete Continuous Import 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);
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)
(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
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 codeInprocessRequest