How o Capture lov even in oaf: If (pageConext.isLovEvent()) { System.out.println(“Inside System.out.println(“Insi de Lov Event”);
String lovInputSourceId = pageContext.getLovInputSourceId(); //checking which lov event is fired /// below EmployeeLovInput is the ID of messagelovinput If (“EmployeeLovInput”.equals(lovInp (“EmployeeLovInput”.equals(lovInputSourceId)) utSourceId))
{ //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).
Real time Project PROJECT:1
Create a customer search page as shown and then link to create customer page
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 New View Object Name As: DivisionVO ---Next — Next a. Rt Click On …poplist.Server – 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 New View Object Name As: CustomerNameLOVVO Rt Click On …poplist.Server – ---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)
New RN Style: Page Button Bar 6) Rt click on Main RN — 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/ Xxc ustomerCreatePage ", 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 Id & Prompt: Edit Style: Image In Table Region — Create 1 Item 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 Id & Prompt: Delete Style: Image In Table Region — Create 1 Item 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} SearchVO-take from AM) (Attribute Name)
--- OK
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\w ebui\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 How to Create LOV in OA Framework pages step by step: 1) 2) 3) 4)
5) 6) 7) 8) 9)
Create the bc4j for LOV.Right click the .jpr create the BC4j for LOV. Ex: xxaam.oracle.apps.po.autosearch.lov.server Under the LOV bc4j, create the LOVVO and LOVAM(this VO and AM called as LOVVO and LOV AM). Ex: xxxLOVVO and xxxLOVAM. Attach that LOVAM to VO. Ex:Add xxxLOVVO to xxxLOVAM. Create the region under jpr, navigation path is -> right click .jpr->New->OAComponenst ->webtier>Region. Ex:xxxLOVRN Dialog Box->In region properties -> style as ListOfValues ->click OK. In structure window select region ->property inspector ->scope – public and add LOV AM To this Region. Come to item search allowed property should be true. Select the page, which item you want to make LOV and select item style as Message LOV Input. In property inspector window ->you have to add region path in external LOV.
10) Come to mapping section , select map1 Property inspector ->functional LOV Region Item – data base column Name Return Item – region Item Criteria Item- same as return item
Manual Search Page: Manual Search Page: Manual Search Page Steps: 1) 2)
Create the page as the normal way like create jws, jpr, bc4js, AM, page etc…. .
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 nd (which you created in 2 step) 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 = "";
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);
} 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 in Search Criteria) Public int /**This is Search page Validation*/ ConsumerSearch (OAPageContext pc,OAWebBean wb) { int flag = 0; //For search page Validation String 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);
} 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 & Commit if(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()
COMPARE TWO NUMBER (Validation on Levels to Greater than one as another) In Create CO (ProcessFormRequest) Write the code b/t save and commit import.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 FIED OAMessageLovInputBean mti=(OAMessageLovInputBean)webBean. findChildRecursive("BillToLocation"); if(mti!=null) {
mti.setInlineStyle(css); }
SPECIAL CHARACTERS ARE NOT ALLOWED ON A FIELD (validation On PartyName) 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: FirepartialAction event: 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()<=0)||(frighting.intValue()>=100)) // if((frighting.intValue()<0)||(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 AM 1.CUSTOMERVO (QUERY) SELECT hp.party_name, hp.party_id,
hp.party_number FROM hz_parties hp WHERE EXISTS (SELECT HCAS.CUST_ACCOUNT_ID,HCAS.PARTY_SITE_ID, HPS.PARTY_ID FROM hz_cust_acct_sites_all HCAS, HZ_PARTY_SITES HPS WHERE HPS.PARTY_SITE_ID = HCAS.PARTY_SITE_ID AND HP.PARTY_ID = HPS.PARTY_ID AND HP.STATUS <> 'M') ORDER BY HP.PARTY_NAME 2. LOCATIONVO (QUERY) SELECT hzsu.site_use_id, hzl.address1||DECODE(hzl.address2,NULL,NULL,','||hzl.address2)|| ','||hzl.city||','||hzl.country||','||hzl.postal_code LOCATION, hp.party_id FROM hz_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 WHERE hza.party_id = hp.party_id AND hzas.cust_account_id = hza.cust_account_id AND hzps.party_site_id = hzas.party_site_id AND hzl.location_id = hzps.location_id AND hzsu.site_use_code = 'BILL_TO' AND hzsu.cust_acct_site_id = hzas.cust_acct_site_id AND hzsu.org_id = hzas.org_id Create one item under DefaultDebouleRegion Item Style: Form Value ID& Prompt: Linkid Create one more Mapping under PartyName In Properties: LOV Region Item: PartyId Return Item: Linkid Create one more Mapping under BillToLocation In Properties: LOV Region Item: PartyId Criteria item: Linkid
DEPENDENT POPLIST Create 2 VO's Under POP List..Server & Attach VO's To AM 1. DNameVO: SELECT DNAME FROM SCOTT.DEPT 2. ENameVO: SELECT ENAME, DNAME FROM SCOTT.EMP E, SCOTT.DEPT D WHERE
E.DEPTNO=D.DEPTNO In Search PG Create Item under MessageComponetLayout Item Style: Message Choice Id & Prompt: DName In Properties: PickListviewinstance: DNameVo PickdisplayAttribute: DName PicklistvalueAttribute: DName Add Block Value : False ( if use this values will enable in field) Action Type: FirePartialAction Event: DName Create one more Item Style: MessageChoice Id & Prompt: EName In Properties: PickListviewinstance: ENameVo PickdisplayAttribute: EName PicklistvalueAttribute: EName Add Block Value : False ( if use this values will enable in field) Go to AMIpmL.java public void initquary (String dname) { EnameVOImpl vo=getEnameVO1(); vo.setWhereClause("DNAME=:1"); vo.setWhereClauseParams(null); vo.setWhereClauseParam(0,dname); vo.executeQuery(); } In Search CO (ProcessFormRequest ) import java.io.Serializable; if("Dname".equals(pageContext.getParameter(EVENT_PARAM))) { String dname=pageContext.getParameter("Dname"); if(!(("".equals(dname))&&(dname==null))) { Serializable[] param={dname}; am.invokeMethod("initquary",param); } } DISPLAY CURRENCY VALUE/FORMAT (Validation on Advertising Rebate) In Search VO we have to ADD 1 Column -Advertising Rebate In Search PG Create Item under Table Region Item Id &Prompt: Advertising Rebate Style: message Styled Text input In Properties: View Instance: SearchVo View Attribute: AdvertisingRebate In Search CO (ProcessRequest) import oracle.apps.fnd.framework.webui.beans.table.OATableBean; import oracle.apps.fnd.framework.webui.beans.message.OAMessageStyledTextBean; OATableBean tb=(OATableBean)webBean.findChildRecursive("region4"); OAMessageStyledTextBean mst=(OAMessageStyledTextBean)webBean.
findChildRecursive("ADVERTISING_REBATE"); if(mst!=null) { mst.setCurrencyCode("USD"); }
EXPORTING DATE TO EXCELL SHEET In Search PG Create Item under RowLoyoutRegion Item Id & Prompt: Export Style: export Button In properties: View Instance: SearchVO
MESSAGE FILE UPLOADBEAN (Validation on Attachment Column) IN Create PG Attachment Data Type: Make sure=BLOB if want display the file Name on the field write below code InprocessRequest import 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 nd EO (which you created in 2 step) into selected side 6) 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}.
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
Create the Sequene with example: create sequence DEPT_DEPT_ID_SEQ Start with 1 increment by 1 Grant all on DEPT_DEPT_ID_SEQ to apps create sequence DEPT_DEPT_ID_SEQ Start 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 AM OAWebBeanConstants.ADD_BREAD_CRUMB_NO, // Do not display breadcrums OAWebBeanConstants.IGNORE_MESSAGES); } Follow Bc4j for each object: AM AND VO -> BC4J XXAAM.oracle.apps.po.xxname.server Entity Object(EO) -> BC4J XXAAM.oracle.apps.po.xxname.schema.server LOV ->BC4J XXAAM.oracle.apps.po.xxname.LOV.server Poplist ->BC4J XXAAM.oracle.apps.po.xxname.poplist.server Controller,Page & Region XXAAM.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.gif Action Type – fireAction Event - Any Name (delete)
Parameter window:SPEL Name – DeptId Value - ${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
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);