Académique Documents
Professionnel Documents
Culture Documents
www.AppsLead.com
Oracle Applications Framework Business Cases
OAF Hello World Tutorial Create OAF Search Page Create Auto Customization Criteria OAF Search Page Clear/ Reset Result Table of Search page in OAF Create Data Entry OAF Page Update Records in OAF Page Create and Update on one click in OA Framework Delete records in OAF Page Implement Master Detail Relationship in OAF Page Working with Key Flex Fields in OAF Implement Dependent LOV in OAF Implement External LOV in OAF Set default Value for messageTextInput item Implement PopList in OA Framework Partial Page Rendering in OAF Execute parameterized PL SQL procedure from OAF page Implement Train in OAF Page D2k to OAF Transformation Call D2K Form from OAF Page Call OAF Page From D2K Form Get Host Name and URL of OAF Page OAF Page to Upload Files into Server from Local Machine Deploy JAR File into R12 in OA Server
Contact Us: 002 010 900 160 23 002 0100 62 62 837 Import Data from Excel sheet to DB Table Import Data from *.xlsx file to DB Table Deploy OAF page Bounce Apache Server Enable Personalization Link for OAF Pages Enable Personalization Link for OAF Pages Deploy JAR File into R12 in OA Server Controller Extension in OAF Application Module Extension in OAF EO based VO Extension in OAF Entity Object Extension in OAF OA Framework Best Practices OAException Message and Dialog Page in OA Framework Deploying OAF Personalizations Command Line Tools Using the Import/Export
JDeveloper 10.1.3.3.0. Available Oracle patch is p8431482_R12_GENERIC.zip Unzip the patch p8431482_R12_GENERIC.zip i.e. in D:\
2. Specify
3. Download dbc file of Oracle application instance from $FND_TOP/secure ( it is like a tnsnames.ora file having connection detail ) Place the file at location D:\p8431482_R12_GENERIC\jdevhome\jdev\dbc_files\secure
4. Open JDeveloper and set database connection goto Connection Navigator > Database and create a new connection
Note Give user name and password do not give any role and do not check Deploy Password checkbox
Note Give Host Name, JDBC port, and SID. Keep driver as thin. Now JDeveloper is ready to use 5. Create a sample workspace and project to know setting during creation of project 1. Goto Application Navigator right click > New > General > Workspace Configured for Oracle Applications 2. Give workspace name
5. Give your dbc file location, application username, application password, application short name, and responsibility key i.e. Application short key and responsibility key is nothing but assigned responsibility detail to the application user for example if application user has System Administrator responsibility then Application short name will be SYSADMIN and responsibility key will be SYSTEM_ADMINISTRATOR. These values are required to compile and run the page because page required context during run time so it will login the application with given username and password and it will take context from assigned responsibility
Title AM Definition
Attribute ID
Property ButtonLayout
2. Create a New Application Module (AM) Right Click on SearchDemo > New > ADF Business Components > Application Module Name -- SearchAM Package -- prajkumar.oracle.apps.fnd.searchdemo.server
3. Enable Passivation for the Root UI Application Module (AM) Right Click on SearchAM > Edit SearchAM > Custom Properties > Name RETENTION_LEVEL Value MANAGE_STATE Click add > Apply > OK
4. Create Test Table and insert data some data in it (For Testing Purpose) CREATE TABLE xx_search_demo ( -- --------------------- Data Columns -- -------------------column1 VARCHAR2(100), column2 VARCHAR2(100), -- --------------------- Who Columns -- -------------------last_update_date DATE NOT NULL, last_updated_by NUMBER NOT NULL, creation_date DATE NOT NULL, created_by NUMBER NOT NULL, last_update_login NUMBER );
5. Create a New Entity Object (EO) Right click on SearchDemo > New > ADF Business Components > Entity Object Name SearchEO Package -- prajkumar.oracle.apps.fnd.searchdemo.schema.server Database Objects -- XX_SEARCH_DEMO
Note By default ROWID will be the primary key if we will not make any column to be primary key Check the Accessors, Create Method, Validation Method and Remove Method
6. Create a New View Object (VO) Right click on SearchDemo > New > ADF Business Components > View Object Name -- SearchVO Package -- prajkumar.oracle.apps.fnd.searchdemo.server In Step2 in Entity Page select SearchEO and shuttle them to selected list In Step3 in Attributes Window select columns Column1, Column2 and shuttle them to selected list In Java page Select Generate Java file for View Object Class: SearchVOImpl and Generate Java File for View Row Class: SearchVORowImpl
7. Add Your View Object to Root UI Application Module Select Right click on SearchAM > Edit SearchAM > Data Model >
8. Create a New Page Right click on SearchDemo > New > Web Tier > OA Components > Page Name -- SearchPG Package -- prajkumar.oracle.apps.fnd.searchdemo.webui
9. Select the SearchPG and go to the strcuture pane where a default region has been created
10. Select region1 and set the following properties: ID -- PageLayoutRN Region Style -- PageLayout AM Definition -- prajkumar.oracle.apps.fnd.searchdemo.server.SearchAM Window Title -- Search Page Window Title -- Search Page Auto Footer -- True
11. Add a Query Bean to Your Page Right click on PageLayoutRN > New > Region Select new region region1 and set following properties ID QueryRN Region Style query Construction Mode resultBasedSearch Include Simple Panel True Include Views Panel True Include Advanced Panel True
12. Add a Result Data Table to your QueryRN Select QueryRN right click > New > Region using Wizard
Note DO NOT select Use this as Application Module Definition for this region checkbox
In Region Properties page, set Region ID value to ResultsTable and Region Style to table In view Attributes page, select attributes from Available View Attributes list and shuttle them to Selected View Atributes list: Column1 Column2 In Region Items Page, you can set ID, Style and Attributes Set. Currently we are going to set only Style as messageStyledText
13. Set and verify Your Results Table Region Properties ID ResultsTable Region Style table AM Please Donot put any AM Rendered True Records Displayed 10 Width 100% User Personalization True
14. Set or Verify Column1 Item Properties Search Allowed -- True Sort Allowed ascending Initial Sort Seqence first Selective Search Criteria True User Personalization True
16. Congratulation you have successfully finished Search page. Run Your SearchPG page and Test Your Work
2. Create a New Application Module (AM) Right Click on CustSearchDemo > New > ADF Business Components > Application Module Name -- CustSearchAM Package -- prajkumar.oracle.apps.fnd.custsearchdemo.server
3. Enable Passivation for the Root UI Application Module (AM) Right Click on CustSearchAM > Edit SearchAM > Custom Properties > Name RETENTION_LEVEL Value MANAGE_STATE Click add > Apply > OK
4. Create Test Table and insert data some data in it (For Testing Purpose)
CREATE TABLE xx_custsearch_demo ( -- ---------------------- Data Columns -- --------------------column1 VARCHAR2(100), column2 VARCHAR2(100), column3 VARCHAR2(100), column4 VARCHAR2(100), -- ---------------------- Who Columns -- --------------------last_update_date DATE NOT NULL, last_updated_by NUMBER NOT NULL,
INSERT INTO xx_custsearch_demo VALUES('v1','v2','v3','v4',SYSDATE,0,SYSDATE,0,0); INSERT INTO xx_custsearch_demo VALUES('v1','v3','v4','v5',SYSDATE,0,SYSDATE,0,0); INSERT INTO xx_custsearch_demo VALUES('v2','v3','v4','v5',SYSDATE,0,SYSDATE,0,0); INSERT INTO xx_custsearch_demo VALUES('v3','v4','v5','v6',SYSDATE,0,SYSDATE,0,0); Now we have 4 records in our custom table
5. Create a New Entity Object (EO) Right click on SearchDemo > New > ADF Business Components > Entity Object Name CustSearchEO Package -- prajkumar.oracle.apps.fnd.custsearchdemo.schema.server Database Objects -- XX_CUSTSEARCH_DEMO
Note By default ROWID will be the primary key if we will not make any column to be primary key
Check the Accessors, Create Method, Validation Method and Remove Method
6. Create a New View Object (VO) Right click on CustSearchDemo > New > ADF Business Components > View Object Name -- CustSearchVO Package -- prajkumar.oracle.apps.fnd.custsearchdemo.server
In Step2 in Entity Page select CustSearchEO and shuttle them to selected list
In Step3 in Attributes Window select columns Column1, Column2, Column3, Column4, and shuttle them to selected list
In Java page deselect Generate Java file for View Object Class: CustSearchVOImpl and Select Generate Java File for View Row Class: CustSearchVORowImpl
7. Add Your View Object to Root UI Application Module Select Right click on CustSearchAM > Application Modules > Data Model Select CustSearchVO and shuttle to Data Model list
8. Create a New Page Right click on CustSearchDemo > New > Web Tier > OA Components > Page Name -- CustSearchPG Package -- prajkumar.oracle.apps.fnd.custsearchdemo.webui
9. Select the CustSearchPG and go to the strcuture pane where a default region has been created
10. Select region1 and set the following properties: ID -- PageLayoutRN Region Style -- PageLayout AM Definition -prajkumar.oracle.apps.fnd.custsearchdemo.server.CustSearchAM Window Title AutoCustomize Search Page Window Title AutoCustomization Search Page Auto Footer -- True
11. Add a Query Bean to Your Page Right click on PageLayoutRN > New > Region
12. Create a New Region of style table Right Click on QueryRN > New > Region Using Wizard Application Module prajkumar.oracle.apps.fnd.custsearchdemo.server.CustSearchAM Available View Usages CustSearchVO1
In Step2 in Region Properties set following properties Region ID CustSearchTable Region Style Table
In Step3 in View Attributes shuttle all the items (Column1, Column2, Column3, Column4) available in Available View Attributes to Selected View Attributes: In Step4 in Region Items page set style to messageStyledText for all items
13. Select CustSearchTable in Structure Panel and set property Width to 100%
14. Include Simple Search Panel Right Click on QueryRN > New > simpleSearchPanel Automatically region2 (header Region) and region1 (MessageComponentLayout Region) created Set Following Properties for region2
15. Now right click on message Component Layout Region (SimpleSearchMappings) and create two message text input beans and set the below properties to each
Message TextInputBean1 Id SearchColumn1 Search Allowed True Data Type VARCHAR2 Maximum Length CSS Class OraFieldText Prompt Column1
Message TextInputBean2 Id SearchColumn2 Search Allowed -- True Data Type VARCHAR2 Maximum Length 100 CSS Class OraFieldText Prompt Column2
16. Now Right Click on query Components and create simple Search Mappings. Then automatically SimpleSearchMappings and QueryCriteriaMap1 created
17. Now select the QueryCriteriaMap1 and set the below properties Id SearchColumn1Map Search Item SearchColumn1 Result Item Column1
18. Now again right click on simpleSearchMappings -> New -> queryCriteriaMap, and then set the below properties Id SearchColumn2Map Search Item SearchColumn2 Result Item Column2
19. Congratulation you have successfully finished Auto Customization Search page. Run Your CustSearchPG page and Test Your Work
Add following Code in your Search page Controller where you have constructed your Query Region
import oracle.apps.fnd.framework.webui.beans.layout.OAQueryBean; ... public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean); OAQueryBean queryBean = (OAQueryBean)webBean.findChildRecursive("QueryRN"); // Here QueryRN is your Query Region Name as shown in following snap shot queryBean.clearSearchPersistenceCache(pageContext); }
Note After add this code, no need to worry about state of Application Module (AM). This code will clean up result table automatically every time when you will open Search page first time and when you are redirecting back to search
1. Create a New Workspace and Project Right click Workspaces and click create new OAworkspace and name it as PRajkumarInsert. Automatically a new OA Project is also created. Name the project as InsertDemo and package as prajkumar.oracle.apps.fnd.insertdemo
2. Create a New Application Module (AM) Right Click on InsertDemo > New > ADF Business Components > Application Module Name -- InsertAM Package -- prajkumar.oracle.apps.fnd.insertdemo.server
3. Enable Passivation for the Root UI Application Module (AM) Right Click on InsertAM > Edit InsertAM > Custom Properties > Name RETENTION_LEVEL Value MANAGE_STATE Click add > Apply > OK
4. Create Test Table in which we will insert data (For Testing Purpose)
CREATE TABLE xx_insert_demo ( -- ---------------------- Data Columns -- --------------------column1 VARCHAR2(100), column2 VARCHAR2(100), -- ---------------------- Who Columns -- --------------------last_update_date DATE NOT NULL, last_updated_by NUMBER NOT NULL, creation_date DATE NOT NULL, created_by NUMBER NOT NULL, last_update_login NUMBER
5. Create a New Entity Object (EO) Right click on InsertDemo > New > ADF Business Components > Entity Object Name InsertEO Package -- prajkumar.oracle.apps.fnd.insertdemo.schema.server Database Objects -- XX_INSERT_DEMO
Note By default ROWID will be the primary key if we will not make any column to be primary key. Check the Accessors, Create Method, Validation Method and Remove Method
6. Create a New View Object (VO) Right click on InsertDemo > New > ADF Business Components > View Object Name -- InsertVO Package -- prajkumar.oracle.apps.fnd.insertdemo.server In Step2 in Entity Page select InsertEO and shuttle them to selected list In Step3 in Attributes Window select columns Column1, Column2 and shuttle them to selected list In Java page deselect Generate Java file for View Object Class: InsertVOImpl and Select Generate Java File for View Row Class: InsertVORowImpl
7. Add Your View Object to Root UI Application Module Right click on InsertAM > Edit InsertAM > Data Model > Select InsertVO in Available View Objects list and shuttle to Data Model list
8. Create a New Page Right click on InsertDemo > New > Web Tier > OA Components > Page Name -- InsertPG Package -- prajkumar.oracle.apps.fnd.insertdemo.webui
9. Select the InsertPG and go to the strcuture pane where a default region has been created
10. Select region1 and set the following properties: ID -- PageLayoutRN Region Style -- PageLayout AM Definition -- prajkumar.oracle.apps.fnd.insertdemo.server.InsertAM Window Title -- Date Entry Page Window Title -- Data Entry Page Auto Footer -- True
11. Right click PageLayoutRN > New > Region ID -- MainRN Region Style -- defaultSingleColumn
12. Create Text Input Items Right click on MainRN > New > Item Set following properties for New Item ID -- COLUMN1 Item Style -- messageTextInput Maximum Length -- 100 Length -- 20 Prompt -- Column1 View Instance -- InsertVO1 View Attribute -- Column1
Again Right click on MainRN > New > Item Set following properties for New Item ID -- COLUMN2
13. Add Apply and Cancel Buttons Right click on PageLayoutRN > New > Region ID -- PageButtons Region Style -- pageButtonBar
Right click on PageButtons > New > Item ID -- Cancel Item Style -- submitButton Attribute Set -- /oracle/apps/fnd/attributesets/Buttons/Cancel Disable Server Side Validation -- True Prompt -- Cancel Warm About Changes -- False Additional Text Select to cancel this transaction.
Right click on PageButtons > New > Item ID -- Apply Item Style -- submitButton Attribute Set -- /oracle/apps/fnd/attributesets/Buttons/Apply Prompt -- Apply Additional Text Select to save this transaction.
15. Create Controller for Page PageLayoutRN > Set New Controller > Package Name: prajkumar.oracle.apps.fnd.insertdemo.webui Class Name: InsertCO
16. Add Create Page Initialization to your Controller Add following code to your processRequest()
import oracle.apps.fnd.framework.OAApplicationModule; ... public void processRequest(OAPageContext pageContext,OAWebBean webBean) { super.processRequest(pageContext, webBean); if (!pageContext.isFormSubmission()) { OAApplicationModule am = pageContext.getApplicationModule(webBean); am.invokeMethod("createRecord", null); } }
17. Add below method in InsertAMImpl Class to handle Apply Button action import oracle.jbo.Transaction; ... public void apply() { getTransaction().commit(); }
18. Add below Logic in InsertCO to handle Apply Button Add following code to your processFormRequest()
import import import import import ... oracle.jbo.domain.Number; oracle.apps.fnd.common.MessageToken; oracle.apps.fnd.framework.OAException; oracle.apps.fnd.framework.OAViewObject; oracle.apps.fnd.framework.webui.OAWebBeanConstants;
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean) {super.processFormRequest(pageContext, webBean); OAApplicationModule am = pageContext.getApplicationModule(webBean); // Pressing the "Apply" button means the transaction should be // validated and committed. if (pageContext.getParameter("Apply") != null) { OAViewObject vo = (OAViewObject)am.findViewObject("InsertVO1"); String column1 = (String)vo.getCurrentRow().getAttribute("Column1"); String column2 = (String)vo.getCurrentRow().getAttribute("Column2"); am.invokeMethod("apply"); // Create a FND Message with name "TEST_CREATE_CONFIRM" with two // tokens MessageToken[] tokens = { new MessageToken("COLUMN1", column1), new MessageToken("COLUMN2", column2)
19. Congratulations you have successfully created data insert page. Run InsertPG page to test Your Work
2. Implement Update Action in SearchPG Right click on ResultTable in SearchPG > New > Item
Attribute ID Item Style Image URI Atribute Set Prompt Additional Text Height Width Action Type Event Submit Parameters
Property UpdateAction image updateicon_enabled.gif /oracle/apps/fnd/attributesets/Buttons/Update Update Update record 24 24 fireAction update True Name PColumn1 Value -- ${oa.SearchVO1.Column1}
3. Create a Update Page Right click on SearchDemo > New > Web Tier > OA Components > Page Name UpdatePG Package prajkumar.oracle.apps.fnd.searchdemo.webui
4. Select the UpdatePG and go to the strcuture pane where a default region has been created
Property PageLayoutRN PageLayout prajkumar.oracle.apps.fnd.searchdemo.server.SearchA M Update Page Window Update Page True
6. Create the Second Region (Main Content Region) Select PageLayoutRN right click > New > Region ID MainRN Region Style messageComponentLayout
Attribute ID Style Property Prompt Data Type Length Maximum Length View Instance View Attribute
8. Create second Item (Empty Field) MainRN > New > messageTextInput
SearchVO1 Column2
9. Create a container Region for Apply and Cancel Button in UpdatePG Select MainRN of UpdatePG MainRN > messageLayout
Attribute Region
Property ButtonLayout
10. Create Apply Button Select ButtonLayout > New > Item
11. Create Cancel Button Select ButtonLayout > New > Item
Attribute
/oracle/apps/fnd/attributesets/Buttons/Cancel
12. Add Page Controller for SearchPG Right Click on PageLayoutRN of SearchPG > Set New Controller Name SearchCO Package -- prajkumar.oracle.apps.fnd.searchdemo.webui
public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean); OAQueryBean queryBean = (OAQueryBean)webBean.findChildRecursive("QueryRN"); queryBean.clearSearchPersistenceCache(pageContext); } public void processFormRequest(OAPageContext pageContext, OAWebBean webBean) { super.processFormRequest(pageContext, webBean); if ("update".equals(pageContext.getParameter(EVENT_PARAM))) { pageContext.setForwardURL("OA.jsp? page=/prajkumar/oracle/apps/fnd/searchdemo/webui/UpdatePG", null, OAWebBeanConstants.KEEP_MENU_CONTEXT, null, null, true, OAWebBeanConstants.ADD_BREAD_CRUMB_NO,
public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean); OAApplicationModule am = pageContext.getApplicationModule(webBean); String Column1 = pageContext.getParameter("PColumn1"); String Column2 = pageContext.getParameter("PColumn2"); Serializable[] params = { Column1, Column2 }; am.invokeMethod("updateRow", params); } public void processFormRequest(OAPageContext pageContext, OAWebBean webBean) { super.processFormRequest(pageContext, webBean); OAApplicationModule am = pageContext.getApplicationModule(webBean); if (pageContext.getParameter("Apply") != null) { am.invokeMethod("apply"); pageContext.forwardImmediately("OA.jsp? page=/prajkumar/oracle/apps/fnd/searchdemo/webui/SearchPG", null, OAWebBeanConstants.KEEP_MENU_CONTEXT, null,
import oracle.apps.fnd.framework.server.OAApplicationModuleImpl; import oracle.apps.fnd.framework.server.OAViewObjectImpl; public void updateRow(String Column1, String Column2) { SearchVOImpl vo = (SearchVOImpl)getSearchVO1(); vo.initQuery(Column1, Column2); } public void apply() { getTransaction().commit(); } public void rollback() { getTransaction().rollback(); }
16. Congratulation you have successfully finished. Run Your Search page and Test Your Work
2. Create a New Application Module (AM) Right Click on SearchDemo > New > ADF Business Components > Application Module Name -- SearchAM Package -- prajkumar.oracle.apps.fnd.searchdemo.server
3. Enable Passivation for the Root UI Application Module (AM) Right Click on SearchAM > Edit SearchAM > Custom Properties > Name RETENTION_LEVEL Value MANAGE_STATE Click add > Apply > OK
4. Create Test Table and insert data some data in it (For Testing Purpose) CREATE TABLE xx_create_upd_demo ( -- ---------------------- Data Columns
5. Create a New Entity Object (EO) Right click on SearchDemo > New > ADF Business Components > Entity Object Name SearchEO Package -- prajkumar.oracle.apps.fnd.searchdemo.schema.server Database Objects -- xx_create_upd_demo
Note By default ROWID will be the primary key if we will not make any column to be primary key. Check the Accessors, Create Method, Validation Method and Remove Method
6. Create a New View Object (VO) Right click on SearchDemo > New > ADF Business Components > View Object Name -- SearchVO Package -- prajkumar.oracle.apps.fnd.searchdemo.server In Step2 in Entity Page select SearchEO and shuttle them to selected list In Step3 in Attributes Window select columns Column1, Column2, Column3, Column4 and shuttle them to selected list In Java page select Generate Java File for View Object Class: SearchVOImpl and Generate Java File for View Row Class: SearchVORowImpl
7. Add Your View Object to Root UI Application Module Select Right click on SearchAM > Application Modules > Data Model > Select SearchVO and shuttle to Data Model list
8. Create a New Page Right click on SearchDemo > New > Web Tier > OA Components > Page Name -- SearchPG Package -- prajkumar.oracle.apps.fnd.searchdemo.webui
9. Select the SearchPG and go to the strcuture pane where a default region has been created
10. Select region1 and set the following properties: ID PageLayoutRN Scope -- Public Region Style -- PageLayout AM Definition -- prajkumar.oracle.apps.fnd.searchdemo.server.SearchAM Window Title Page Window Title Page Header Auto Footer True
15. Create a New Second Page Right click on SearchDemo > New > Web Tier > OA Components > Page Name -- CreateUpdPG Package -- prajkumar.oracle.apps.fnd.searchdemo.webui
16. Select the CreateUpdPG and go to the strcuture pane where a default region has been created
17. Select region1 and set the following properties: ID PageLayoutRN Scope -- Public Region Style -- PageLayout AM Definition -- prajkumar.oracle.apps.fnd.searchdemo.server.SearchAM
Create Second Item MainRN > New > item Set Following properties for new item ID Column2 Style Property messageTextInput Prompt Column2 Data Type VARCHAR2
Create Third Item MainRN > New > item Set Following properties for new item ID Column3 Style Property messageTextInput Prompt Column3 Data Type VARCHAR2 Length 20 Maximum Length 100 View Instance -- SearchVO1 View Attribute -- Column3
Create Fourth Item MainRN > New > item Set Following properties for new item ID Column4 Style Property messageStyledText Prompt Column4 Data Type NUMBER View Instance -- SearchVO1 View Attribute -- Column4
20. Add Controller for Page SearchPG Select PageLayoutRN right click Set New Controller
Package Name -- prajkumar.oracle.apps.fnd.searchdemo.webui
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean) { super.processFormRequest(pageContext, webBean); if (pageContext.getParameter("Go") != null) { String userContent = pageContext.getParameter("MyId"); HashMap hmap = new HashMap(); hmap.put("MyId", userContent); pageContext.setForwardURL( "OA.jsp?page=/prajkumar/oracle/apps/fnd/searchdemo/webui/CreateUpdPG", null, OAWebBeanConstants.KEEP_MENU_CONTEXT, null, hmap, true, OAWebBeanConstants.ADD_BREAD_CRUMB_NO, OAWebBeanConstants.IGNORE_MESSAGES); } }
Destination URI OA.jsp? page=/prajkumar/oracle/apps/fnd/searchdemo/webui/SearchPG&retainAM=Y Text Return to SearchPG Copyright 2013, AppsLead. All rights reserved
23. Add Controller for Page CreateUpdPG Select PageLayoutRN right click Set New Controller
Package Name -- prajkumar.oracle.apps.fnd.searchdemo.webui Class Name -- CreateUpdCO Add Following code in that controller
import java.io.Serializable; import oracle.apps.fnd.framework.OAApplicationModule; import oracle.apps.fnd.framework.webui.OAWebBeanConstants; public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean); OAApplicationModule am = pageContext.getApplicationModule(webBean); String val = pageContext.getParameter("MyId"); Serializable[] params = { val }; am.invokeMethod("createRow", params); }
24. Add Following code in SearchAMImpl.java import oracle.apps.fnd.framework.server.OAApplicationModuleImpl; import oracle.jbo.Row; public void createRow(String Val) { SearchVOImpl vo = getSearchVO1(); vo.initQuery(Val); int rowCount = vo.getRowCount(); if ( rowCount < 3 ) { for(int i = 3; i != rowCount ; rowCount++) { Row studrow = vo.createRow(); vo.last(); vo.next(); vo.insertRow(studrow); vo.setCurrentRow(studrow); vo.getCurrentRow().setAttribute("Column4",Val); studrow.setNewRowState(Row.STATUS_INITIALIZED); } Copyright 2013, AppsLead. All rights reserved
Contact Us: 002 010 900 160 23 002 0100 62 62 837 } } 25. Add Following code in SearchVOImpl.java import oracle.jbo.domain.Number; import oracle.apps.fnd.framework.OAException; import oracle.apps.fnd.framework.server.OAViewObjectImpl; public void initQuery(String Val) { if ((Val != null) && (!("".equals(Val.trim())))) { // Do the following conversion for type consistency. Number Val2 = null; try { Val2 = new Number(Val); } catch(Exception e) { throw new OAException("AK", "FWK_TBX_INVALID_EMP_NUMBER"); } setWhereClause("Column4 = :1"); setWhereClauseParams(null); // Always reset setWhereClauseParam(0, Val2); executeQuery(); } }
26. Congratulation you have successfully finished. Run Your SearcgPG page and Test Your Work
2. Implement a Delete in your SearchEOImpl Class public void remove() { super.remove(); } // end remove()
3. Create a Delete Image Select ResultsTable right click > New > Item Set following properties for New Item ID DeleteAction Item Style image Image URI deleteicon_enabled.gif Atribute Set -- /oracle/apps/fnd/attributesets/Buttons/Delete Prompt -- Delete Additional Text Delete record action enabled Height 24 Width 24 Action Type fireAction Event delete Submit True Select Parameter Properties define parameter name as Column1 and whose value is ${oa.SearchVO1.Column1} Select Parameter Properties define parameter name as Column2 and whose value is ${oa.SearchVO1.Column2} Select OK button to create your request parameters
4. Add Page Controller Add a New Contoller for SearchPG Name SearchCO Package -- prajkumar.oracle.apps.fnd.searchdemo.webui
Implement Delete Action 5. Add deleteRecord() method to SearchAMImpl import import import import import ... oracle.apps.fnd.framework.OAViewObject; oracle.apps.fnd.framework.server.OAApplicationModuleImpl; oracle.jbo.domain.Number; oracle.apps.fnd.framework.server.OAViewObjectImpl; oracle.jbo.RowSetIterator;
public void deleteRecord(String Column1) { OAViewObject vo = (OAViewObject)getSearchVO1(); SearchVORowImpl 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 = (SearchVORowImpl)deleteIter.getRowAtRangeIndex(i); row.remove(); getTransaction().commit(); break; } } deleteIter.closeRowSetIterator(); } // end deleteRecord
6. Add DeleteSelection Handler Code to SearchCO.processFormRequest() import import import import import import import import ... com.sun.java.util.collections.HashMap; oracle.apps.fnd.framework.webui.OADialogPage; oracle.apps.fnd.framework.webui.OAWebBeanConstants; oracle.apps.fnd.common.MessageToken; oracle.apps.fnd.framework.OAException; oracle.apps.fnd.framework.webui.OAWebBeanConstants; oracle.apps.fnd.framework.OARow; oracle.apps.fnd.framework.OAApplicationModule;
8. Congratulation you have successfully finished. Run Your page and Test Your Work
1. Create a New OA Workspace and Empty OA Project File> New > General> Workspace Configured for Oracle Applications File Name -- MasterDetailProj Project Name MasterDetailDemo Default Package -- prajkumar.oracle.apps.fnd.masterdetaildemo
2. Create Application Module AM MasterDetailDemo right click > New > ADF Business Components > Application Module Name -- MasterdetailDemoAM Package -- prajkumar.oracle.apps.fnd.masterdetaildemo.server Check Generate JavaFile(s)
3. We need two tables one table will be act as Master table and second table will be act as Child or detail table. Lets Create two tables -- Master Table CREATE TABLE master_table_demo ( -- ---------------------- Data Columns -- --------------------Column1 VARCHAR2(100), Column2 VARCHAR2(100), -- ----------------------- Who Columns -- ---------------------last_update_date DATE NOT NULL, Copyright 2013, AppsLead. All rights reserved
Contact Us: 002 010 900 160 23 002 0100 62 62 837 last_updated_by creation_date created_by last_update_login ); -- Detail Table CREATE TABLE detail_table_demo ( -- ---------------------- Data Columns -- --------------------Column1 VARCHAR2(100), Column2 VARCHAR2(100), -- ----------------------- Who Columns -- ---------------------last_update_date DATE NOT NULL, last_updated_by NUMBER NOT NULL, creation_date DATE NOT NULL, created_by NUMBER NOT NULL, last_update_login NUMBER );
Note Consider Master Table is Linked to Detail Table with Column1
-- Insert Data into Detail Table INSERT INTO detail_table_demo VALUES ( VAL1, VAL6, SYSDATE, 0, SYSDATE, 0, 0); INSERT INTO detail_table_demo VALUES ( VAL3, VAL8, SYSDATE, 0,
5. Create a New Entity Object (EO) for Master Table Right click on MasterDetailDemo > New > ADF Business Components > Entity Object Name MasterEO Package -- prajkumar.oracle.apps.fnd.masterdetaildemo.schema.server Database Objects -- master_table_demo
Check the Accessors, Create Method, Validation Method and Remove Method
Check the Accessors, Create Method, Validation Method and Remove Method
Note Column1 in both tables is common Column to make parent child relationship 7. Lets Create View Object for Master Table
In Step3 in Attributes Window select columns Column1, Column2, DetailFlag and shuttle them to selected list In Java page deselect Generate Java file for View Object Class: MasterVOImpl
9. Create View Link Add Your View Object to Root UI Application Module
Right click on MasterDetailDemo > New > ADF Business Components > View Link Name MasterdetailDemoVL Package -- prajkumar.oracle.apps.fnd.masterdetaildemo.server
12. Select MasterdetailDemoPG and go to the strcuture pane where a default region has been created
14. Add a New Region MainRN Select PageLayoutRN right click > New > Region ID -- MainRN Region Style header
15. Create a Master Table Region Select MainRN > New > Region ID MainTableRN Region Style -- advancedTable View Instance -- MasterVO1 Detail View Attribute DetailFlag Child View Attribute -- Column1 View Link Instance -- MasterdetailDemoVL1 Width 100% Rendered True
16. Create Columns and their items for MainTableRN Create Column1 Select MainTableRN > New > column Select column1 > New > Item ID item1 Item Style messageStyledText View Attribute Column1
Create Column2 Select MainTableRN > New > column Select column2 > New > Item ID item2 Item Style messageStyledText View Attribute Column2
17. Create a Detail Region Select MainTableRN > New > detail A new Region will be get created under detail set following properties for that region ID DetailRN Region Style header
18. Create a DetailTable Region Select DetailRN > New > Region For New region set following Properties ID DetailTableRN Region Style advancedTable View Instance -- DetailVO2 View Link Instance -- MasterdetailDemoVL1 Width 100% Rendered True
19. Create Columns and their items for DetailTableRN Create Column3 Select DetailTableRN > New > column Select column3 > New > Item ID item3
Create Column4 Select DetailTableRN > New > column Select column4 > New > Item ID item4 Item Style messageStyledText View Instance DetailVO2 View Attribute Column2
20. Add Controller for Page MasterdetailDemoPG Select PageLayoutRN right click Set New Controller Package Name -- prajkumar.oracle.apps.fnd.masterdetaildemo.webui Class Name -- MasterdetailDemoCO Set Following Code in CO
import oracle.apps.fnd.framework.webui.OAPageContext; import oracle.apps.fnd.framework.webui.beans.OAWebBean; import prajkumar.oracle.apps.fnd.masterdetaildemo.server.MasterdetailDemoAMImpl ; ... public void processRequest(OAPageContext pageContext, webBean) { super.processRequest(pageContext, webBean); OAWebBean
in
your
AMImpl
Class
import oracle.apps.fnd.framework.webui.OAPageContext; import oracle.apps.fnd.framework.webui.beans.OAWebBean; ... public void MasterDetails(OAPageContext webBean) { MasterVOImpl pvo = getMasterVO1(); pvo.executeQuery(); } pageContext,OAWebBean
2. Create a New Application Module (AM) Right Click on KFFDemo > New > ADF Business Components > Application Module Name -- KFFAM Package -- prajkumar.oracle.apps.fnd.kffdemo.server
3. Create a New View Object (VO) Right click on KFFDemo > New > ADF Business Components > View Object Name -- KFFVO Package -- prajkumar.oracle.apps.fnd.kffdemo.server
Note - The VO is not based on any EO so click next and go to the query section and paste the query
In Step8 Check Object Class: KFFVOImpl -> Generate Java File -> Bind Variable Accessors
4. Add View Object to Root UI Application Module Right Click on KFFAM > Edit KFFAM > Data Model and shuttle KFFVO from Available View Objects to Data Model Copyright 2013, AppsLead. All rights reserved
5. Create a New Page Right click on KFFDemo > New > Web Tier > OA Components > Page Name -- KFFPG Package -- prajkumar.oracle.apps.fnd.kffdemo.webui
6. Select the KFFPG and go to the strcuture pane where a default region has been created
Property PageLayoutRN prajkumar.oracle.apps.fnd.kffdemo.server.KFFAM Key Flex Field Demo Window Key Flex Field Demo
8. Create Stack Layout Region Under Page Layout Region Right click PageLayoutRN > New > Region
Attribute ID AM Definition
9. Create a New Item of type Flex under the Stack Layout Region
Appl Short Name SQLGL Name Type View Instance GL# Key KFFVO1
10. Create Controller for page KFFPG Right Click on PageLayoutRN > Set New Controller Package Name: prajkumar.oracle.apps.fnd.kffdemo.webui Class Name: KFFCO
Write Following Code in KFFCO processRequest public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean); OAKeyFlexBean kffId = (OAKeyFlexBean)webBean.findIndexedChildRecursive("KeyFlexItem"); // Set the code combination lov kffId.useCodeCombinationLOV(true); Copyright 2013, AppsLead. All rights reserved
Contact Us: 002 010 900 160 23 002 0100 62 62 837 //set the structure code for the item key flex kffId.setStructureCode("FED_AFF"); //Set the attribute name to the item kffId.setCCIDAttributeName("CodeCombinationId"); //Execute the Query KFFAMImpl am = (KFFAMImpl)pageContext.getApplicationModule(webBean); KFFVOImpl vo = (KFFVOImpl)am.findViewObject("KFFVO1"); if(!vo.isPreparedForExecution()) { vo.executeQuery(); } }
Note -- If you do not want to see the key flex field is merging one then change the code in the controller class as below
kffId.useCodeCombinationLOV(false);
11. Use the below Query to find the Structure Code
SELECT fif.application_id, fif.id_flex_code, fif.id_flex_name, fif.application_table_name, fif.description, fifs.id_flex_num, fifs.id_flex_structure_code, fifse.segment_name, fifse.segment_num, fifse.flex_value_set_id FROM fnd_id_flexs fif, fnd_id_flex_structures fifs, fnd_id_flex_segments fifse WHERE fif.application_id = fifs.application_id AND fif.id_flex_code = fifs.id_flex_code AND fifse.application_id = fif.application_id AND fifse.id_flex_code = fif.id_flex_code AND fifse.id_flex_num = fifs.id_flex_num
12. Congratulation you have successfully finished. Run Your page and Test Your Work
Note -- Check Run Option Property for Project. Right Click on DependentLovDemo > Oracle Applications > Run Options. Check OADeveloperMode should not be inSelected Options if it is there in Selected Options list then shuttle it back to Available Options
2. Create a New Application Module (AM) Right Click on DependentLovDemo > New > ADF Business Components > Application Module Name -- DependentLovAM Package -- prajkumar.oracle.apps.fnd.dependentlovdemo.server
3. Create a New View Object (VO) Right click on DependentLovDemo > New > ADF Business Components > View Object Name DependentLovVO1 Package -- prajkumar.oracle.apps.fnd.dependentlovdemo.server
Note - The VO is not based on any EO so click next and go to the query section and paste the query
SELECT person_id, full_name FROM per_all_people_f WHERE SYSDATE BETWEEN effective_start_date AND effective_end_date
4. Create a New View Object for Second Lov (VO) Right click on DependentLovDemo > New > ADF Business Components > View Object Name DependentLovVO2 Package -- prajkumar.oracle.apps.fnd.dependentlovdemo.server
Note - The VO is not based on any EO so click next and go to the query section and paste the query
SELECT pcr.person_id, papf.full_name FROM per_contact_relationships pcr, per_all_people_f papf WHERE papf.person_id = pcr.contact_person_id AND SYSDATE BETWEEN pcr.date_start AND NVL(pcr.date_end,SYSDATE) AND SYSDATE BETWEEN papf.effective_start_date AND papf.effective_end_date
5. Add Your View Objects to Root UI Application Module Select Right click on DependentLovAM > Edit DependentLovAM > Data Model > Select DependentLovVO1 and DependentLovVO2 and shuttle to Data Model list
6. Create First LOV Region Right click on DependentLovDemo > New > Web Tier > OA Components > Region Name -- FirstLovRN Package -- prajkumar.oracle.apps.fnd.dependentlovdemo.webui Region Style -- listOfValues Scope -- Public
Note - The property Scope is the key property which makes the LOV region
7. Right click on FirstLovRN and click table using wizard. In the wizard choose the prajkumar.oracle.apps.fnd.dependentlovdemo.server.DependentLov AM and select DependentLovVO1_1. Click Next
8. Shuttle the two attributes to the right side.That is PersonId and FullName
ID PersonId_LOV FullName_LOV
Property True
False
13. Create Second LOV Region Right click on DependentLovDemo > New > Web Tier > OA Components > Region Name -- SecondLovRN Package -- prajkumar.oracle.apps.fnd.dependentlovdemo.webui Region Style -- listOfValues Scope -- Public
Note - The property Scope is the key property which makes the LOV region public and makes it usable in multiple pages
14. Right click on SecondLovRN and click table using wizard. In the wizard choose the prajkumar.oracle.apps.fnd.dependentlovdemo.server.DependentLov AM and select DependentLovVO2_1. Click Next
15. Shuttle the two attributes to the right side.That is PersonId and FullName
ID
Prompt
Style
Datatype
Property True
False
20. Create a New Page Right click on DependentLovDemo > New > Web Tier > OA Components > Page
21. Select the DependentLovPG and go to the strcuture pane where a default region has been created
Attribut e ID
Property
PageLayoutRN
AM prajkumar.oracle.apps.fnd.dependentlovdemo.server.DependentL Definition ovAM Window Title Title Dependent List of values Demo Window
24. Create a New item to store Return result of First LOV and to give Search Criteria to second LOV Select PageLayoutRN > New > Item Set following Properties for New Item
25. Right click the MainRN and click new messageLovInput Set Following Properties for Newly Created messageLovInput
Prompt
Employee Name
Create LovMap2 and set following properties for that -Select Employee_Name > lovMappings right click New > lovMap Set following properties for lovMap2 --
26. Right click the MainRN and click new messageLovInput Set Following Properties for Newly Created messageLovInput
True
True
Dependent Name
Create LovMap4 and set following properties for that -Select Dependent_Name > lovMappings right click New > lovMap Set following properties for lovMap4 --
27. Congratulation you have successfully finished. Run Your page and Test Your Work
2. Create a New Application Module (AM) Right Click on LovDemo > New > ADF Business Components > Application Module Name -- LovAM Package -- prajkumar.oracle.apps.fnd.lovdemo.server
3. Create a New View Object (VO) Right click on LovDemo > New > ADF Business Components > View Object Name -- LovVO Package -- prajkumar.oracle.apps.fnd.lovdemo.server
Note - The VO is not based on any EO so click next and go to the query section and paste the query SELECT FROM employee_number, full_name per_all_people_f
5. Create a New Page Right click on LovDemo > New > Web Tier > OA Components > Page Name -- LovPG Package -- prajkumar.oracle.apps.fnd.lovdemo.webui
7. Select region1 and set the following properties: ID -- PageLayoutRN AM Definition -- prajkumar.oracle.apps.fnd.lovdemo.server .LovAM Window Title -- List of values Demo Window Title List of values Demo
8. Right click PageLayoutRN and click new Region ID -- MainRN Region Style messageComponentLayout Note - Style is given as messageComponentlayout because we are going to create only message components that is messageLovInput item in that region
9. Create a New Region Right click on LovDemo > New > Web Tier > OA Components > Region Name -- EmployeeLovRN Package -- prajkumar.oracle.apps.fnd.lovdemo.webui Region Style -- listOfValues Scope -- Public
Note - The property Scope is the key property which makes the LOV region public and makes it usable in multiple pages
10. Select EmployeeLovRN. Right click on EmployeeLovRN in Structure pane and click table using wizard. In the wizard choose the prajkumar.oracle.apps.fnd.lovdemo.server.LovAM and select the LovVO1. Click Next Region Id -- LovRN Region style -- table
11. Shuttle the two attributes to the right side.That is EmployeeNumber and FullName
13. Select the field FullName and set the following properties: Search Allowed -- True Selective Search Criteria True
Note - The first property lets users search on these values in the LOV, and the second property ensures that the users specify search criteria for at least one of these values to avoid a blind query
14. Click on LovPG and right click the MainRN and click new messageLovInput External Lov -- /prajkumar/oracle/apps/fnd/lovdemo/webui/EmployeeLovRN Lov Region Item -- FullName Return Item -- item1 Criteria Item -- item1 Prompt -- Employee Name
15. Congratulation you have successfully finished. Run Your page and Test Your Work
4. Select SetDefaultPG and go to the strcuture pane where a default region has been created
5. Select region1 and set the following properties:
Attribute ID
Property PageLayoutRN
Region Style Form Property Auto Footer Window Title Title AM Definition
pageLayout True True Set Default Value Window Title Set Default Value Header prajkumar.oracle.apps.fnd.setdefaultproj.SetDefaultAM
7. Create messageTextInput
MainRN > New > messageTextInput
9. Add a Controller
MainRN > Set New Controller
import oracle.apps.fnd.framework.webui.beans.message.OAMessageTextInp utBean; public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean); String myValue = "My Default Value"; OAMessageTextInputBean textBean = (OAMessageTextInputBean)webBean.findChildRecursive("MyTextite mId"); textBean.setValue(pageContext, myValue); }
2. Create a New Application Module (AM) Right Click on PopListDemo > New > ADF Business Components > Application Module Name -- poplistdemoAM Package -- prajkumar.oracle.apps.fnd.poplistdemo.server
3. Create a New View Object (VO) Right click on PopListDemo > New > ADF Business Components > View Object Name -- poplistdemoVO Package -- prajkumar.oracle.apps.fnd.poplistdemo.server Note - The VO is not based on any EO so click next and go to the query section and paste the query
4. Create a New Page Right click on PopListDemo > New > Web Tier > OA Components > Page Name -- poplistdemoPG
5. Select the poplistdemoPG and go to the strcuture pane where a default region has been created
6. Select region1 and set the following properties: ID -- PageLayoutRN AM Definition -- prajkumar.oracle.apps.fnd.poplistdemo.server.poplistdemoAM Window Title -- PopList Demo Window Title PopList Demo Header
7. Right click PageLayoutRN and click new Region ID -- MainRN Region Style messageComponentLayout
8. Verify Your VO attribute name Select poplistdemoVO right click > Edit poplistdemoVO > Attributes > Verify the Name it should be poplist_items if it is not then edit it and enter name poplist_items
9. Create the first Item (Empty Field) MainRN > New > messageChoice
Set following properties for new item ID MyPopList Required -- Yes Picklist View Definition -prajkumar.oracle.apps.fnd.poplistdemo.server.poplistdemoVO Picklist Display Attribute poplist_items (Name of Attribute in Your VO) Picklist Value Attribute -- poplist_items
10. Congratulation you have successfully finished. Run Your page and Test Your Work
1. Create a New OA Workspace and Empty OA Project File> New > General> Workspace Configured for Oracle Applications File Name -- PPRProj Project Name PPRDemoProj Default Package -- prajkumar.oracle.apps.fnd.pprdemo
2. Create Application Module AM PPRDemoProj right click > New > ADF Business Components > Application Module Name -- PPRAM Package -- prajkumar.oracle.apps.fnd.pprdemo.server
3. Create a PPRVO View Object PPRDemoProj> New > ADF Business Components > View Objects Name PPRVO Package prajkumar.oracle.apps.fnd.pprdemo.server
In Attribute Page Click on New button and create transient primary key attribute with the following properties:
Attribute
Property
Click New button again and create transient attribute with the following properties:
4. Add Your View Object to Root UI Application Module Right click on PPRAM > Edit PPRAM > Data Model > Select PPRVO in Available View Objects list and shuttle to Data Model list
5. Create a OA components Page PPRDemoProj right click > New > OA Components > Page Name PPRPG Package -- prajkumar.oracle.apps.fnd.pprdemo.webui
Attribute ID Region Style Form Property Auto Footer Window Title Title AM Definition
Property PageLayoutRN pageLayout True True PPR Demo Window Title True PPR Demo Page Header prajkumar.oracle.apps.fnd.pprdemo.server.PPR AM
7. Create the Second Region (Main Content Region) Right click on PageLayoutRN > New > Region
Create First messageTextItem -Right click on MainRN > New > messageTextInput
Attribute ID
Property TextItem1
Region Style Prompt Length Disable Server Side Validation Disable Client Side Validation Action Type Event Submit
Note -- Disable Client Side Validation and Event property appears after you set the Action Type property to firePartialAction
Create Second messageTextItem -Select MainRN right click > New > messageTextInput
Contact Us: 002 010 900 160 23 002 0100 62 62 837 import import import import oracle.apps.fnd.framework.OARow; oracle.apps.fnd.framework.OAViewObject; oracle.apps.fnd.framework.server.OAApplicationModuleImpl; oracle.apps.fnd.framework.server.OAViewObjectImpl;
public void handlePPRAction() { Number val = 1; OAViewObject vo = (OAViewObject)findViewObject("PPRVO1"); if (vo != null) { if (vo.getFetchedRowCount() == 0) { vo.setMaxFetchSize(0); vo.executeQuery(); vo.insertRow(vo.createRow()); OARow row = (OARow)vo.first(); row.setAttribute("RowKey", val); row.setAttribute("TextItem2Render", Boolean.FALSE); } } }
10. Implement Controller for Page Select PageLayoutRN in Structure pane right click > Set New Controller Package Name -- prajkumar.oracle.apps.fnd.pprdemo.webui Class Name PPRCO
import oracle.apps.fnd.framework.OARow; import oracle.apps.fnd.framework.OAViewObject; public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean);
11. Congratulation you have successfully finished. Run Your PPRPG page and Test Your Work
1. Create a New OA Workspace and Empty OA Project File> New > General> Workspace Configured for Oracle Applications File Name -- ParameterizedProcProj Project Name ParameterizedProcDemo Default Package -- prajkumar.oracle.apps.fnd.parameterizedprocdemo
2. Create Application Module AM Right click on ParameterizedProcProj > New > ADF Business Components > Application Module Name -- ParameterizedProcDemoAM Package -- prajkumar.oracle.apps.fnd.parameterizedprocdemo.server Check Application Module Class: ParameterizedProcDemoAMImpl Generate JavaFile(s)
4. Select region1 and set the following properties: ID -- PageLayoutRN Region Style -- PageLayout AM Definition --prajkumar.oracle.apps.fnd.parameterizedprocdemo.server.ParameterizedPro cDemoAM
5. Add a New Region MainRN Select PageLayoutRN right click > New > Region ID -- MainRN Region Style messageComponentLayout
Create item1 Select MainRN > New > messageTextInput Set following Properties for Text Item1 ID item1 Item Style messageTextInput Data Type -- Number Prompt Text Item1 Maximum Length 20 Length -- 20
Create item2 Select MainRN > New > messageTextInput Set following Properties for Text Item1 ID item2 Item Style messageTextInput Data Type -- Number Prompt Text Item2 Maximum Length 20
7. Create a Submit Button Right Click on MainRN > New > messageLayout Select newly created messageLayout right click > New > item Set Following Properties for newly created item ID Sum Item Style submitButton Attribute Set -- /oracle/apps/fnd/attributesets/Buttons/Go Prompt Sum
9. Let us create a package and package body which we will call from OAF page This Package takes three parameters all are number. First two are IN parameters and last is OUT as sum of first two numbers
Package Spec
CREATE OR REPLACE PACKAGE BODY APPS.test_package IS PROCEDURE data_sum ( item1 IN NUMBER, item2 IN NUMBER, data_sum OUT NUMBER ) IS BEGIN data_sum := item1 + item2; END data_sum; END test_package; / SHOW ERRORS; EXIT;
your
AMImpl
Class
11. Add Controller for Page ParameterizedProcDemoPG PageLayoutRN right click Set New Controller
Select
Package Name -- prajkumar.oracle.apps.fnd.parameterizedprocdemo.webui Class Name -- ParameterizedProcDemoCO Add Following Code in Controller
12. Congratulation you have successfully finished. Your ParameterizedProcDemoPG page and Test Your Work
Run
1. Create a New OA Workspace and Empty OA Project File> New > General> Workspace Configured for Oracle Applications File Name -- TrainProj Project Name TrainDemoProj Default Package -- prajkumar.oracle.apps.fnd.traindemo
2. Create Application Module AM TrainDemoProj right click > New > ADF Business Components > Application Module Name -- TrainDemoAM Package -- prajkumar.oracle.apps.fnd.traindemo.server Check Generate JavaFile(s)
Create Three Pages TrainDemoPG1, TrainDemoPG2 and TrainDemoPG3 as similar way as mention below to create TrainDemoPG1 3. Create a OA components Pages TrainDemoProj right click > New > OA Components > Page Name TrainDemoPG1 Package -- prajkumar.oracle.apps.fnd.traindemo.webui
4. Modify the Page Layout (Top-level) Region Attribute ID Region Style Property PageLayoutRN pageLayout
True True Train Demo Window Title Train Demo Page Header prajkumar.oracle.apps.fnd.traindemo.server.TrainDem oAM
5. Create the Second Region (Main Content Region) Select PageLayoutRN right click > New > Region Attribute ID Region Style Property MainRN messageComponentLayout
Create Text Items for all three pages say TextItemPage1, TextItemPage2 and TextItemPage3 in respective pages TrainDemoPG1, TrainDemoPG2 and TrainDemoPG3 in similar way of as mention below to create TextItemPage1 in page TrainDemoPG1 6. Create Text Items Select MainRN right click > New > messageTextInput Prompt TextItemPage1 Length -- 20
7. Create a Standalone Train Region TrainDemoProj > New > Web Tier > OA Components > Region Name -- TrainRN Package prajkumar.oracle.apps.fnd.traindemo.webui
8. Add Three Train Nodes to TrainRN Right Click on TrainRN in Structure pane > New > Link Set the link properties as follow -ID TrainStep1 Item Style link Text Step 1 Destination URI OA.jsp? page=/prajkumar/oracle/apps/fnd/traindemo/webui/TrainDemoPG1
Right Click on TrainRN in Structure pane > New > Link Set the link properties as follow -ID TrainStep2 Item Style link Text Step 2 Destination URI OA.jsp? page=/prajkumar/oracle/apps/fnd/traindemo/webui/TrainDemoPG2
Right Click on TrainRN in Structure pane > New > Link Set the link properties as follow -ID TrainStep3 Item Style link Text Step 3 Destination URI OA.jsp? page=/prajkumar/oracle/apps/fnd/traindemo/webui/TrainDemoPG3
9. Add Train Region to each of your Pages For each of three pages in multistep flow, right click the pageLayoutRN in
10. Create a Standalone (Shared) TrainFooterRN TrainDemoProj > New > Web Tier > OA Components > Region Name -- TrainFooterRN Package -- prajkumar.oracle.apps.fnd.traindemo.webui Region Style -- pageButtonBar
11. Add navigrationBar Select TrainFooterRN in Structure pane right click > New > Region Set the region properties as follows: ID -- NavBar Region Style navigationBar First Step 1 Last Step 3
12. Add Links to the navigrationBar Right Click on NavBar > New > link Set Items properties as follows: ID Step1Link Item Style link Text Step 1 of 3: Page1 Warn About Changes False Destination URI -- /prajkumar/oracle/apps/fnd/traindemo/webui/TrainDemoPG1
Right Click on NavBar > New > link Set Items properties as follows: ID Step3Link Item Style link Text Step 3 of 3: Page3 Warn About Changes False Destination URI -- /prajkumar/oracle/apps/fnd/traindemo/webui/TrainDemoPG3
13. Initialize the Footer Region Select TrainFooterRN in Structure pane right click > Set New Controller Class Name -- TrainDemoCO Package Name prajkumar.oracle.apps.fnd.traindemo.webui Add following code in processRequest()
import oracle.apps.fnd.framework.webui.beans.nav.OATrainBean; import oracle.apps.fnd.framework.webui.beans.nav.OANavigationBarBean; ... public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean); OATrainBean trainBean = (OATrainBean)pageContext.getPageLayoutBean().getLocation(); trainBean.prepareForRendering(pageContext);
14. Add the Navigation Region to your pages For each of three pages in the multistep flow, right click the PageLayoutRN in Structure pane and select New > Region Set the regions properties as follow: ID -- PageButtonBar Style -- pageButtonBar Extends -- /prajkumar/oracle/apps/fnd/traindemo/webui/TrainFooterRN 15. Congratulation you have successfully finished. Run Your TrainDemoPG1 page and Test Your Work
Step 2 Next, you will create a OA Page within hello project Think OA Page as the fmx file itself in D2K. I am saying so because this page gets attached to the form function.
This page will be created within hello project, hence the package nameoracle.apps.ak.hello.webui Note the webui, it is a convention to have page in webui, means this page represents the Web User Interface You will assign the default AM [OAApplicationModule]. Think of AM "Connection Manager" and "Transaction State Manager" for your page Copyright 2013, AppsLead. All rights reserved
Contact Us: 002 010 900 160 23 002 0100 62 62 837 I can't co-relate this to anything in D2k, as there is no concept of Connection Pooling and that D2k is not stateless. Reason being that as soon as you kick off a D2K Form, it connects to a single session of Oracle and sticks to that single Oracle database session. So is not the case in OAF, hence AM is needed. Step 3 You create Region within the Page. Region is what will store your fields. Text input fields will be of type messageTextInput. Think of Canvas in D2K. You can have nested regions. Stacked Canvas in D2K comes the closest to this component of OA Framework Step 4 Add a button to one of the nested regions
The itemStyle should be submitButton, in case you want the page to be submitted when this button is clicked There is no WHEN-BUTTON-PRESSED trigger in OAF. In Framework, you will add a controller java code to handle events like Form Submit button clicks. JDeveloper generates the default code for you. Primarily two functions [should I call methods] will be created processRequest [for UI Rendering Handling] and processFormRequest
Think of processRequest as WHEN-NEW-FORM-INSTANCE, though processRequest is very restrictive. Note What is the difference between processRequest and processFormRequest? These two methods are available in the Default Controller class that gets created. processFormRequest This method is commonly used to react/respond to the event that has taken place, for example click of a button. Some examples are if(oapagecontext.getParameter("Cancel") != null) (Do your processing for Cancellation/ Rollback)
Contact Us: 002 010 900 160 23 002 0100 62 62 837 if(oapagecontext.getParameter("Submit") != null) (Do your validations and commit here) if(oapagecontext.getParameter("Update") != null) (Do your validations and commit here) In the above three examples, you could be calling oapagecontext.forwardImmediately to re-direct the page navigation to some other page if needed. processRequest In this method, usually page rendering related code is written. Effectively, each GUI component is a bean that gets initialised during processRequest. Those who are familiar with D2K forms, something like pre-query may be written in this method. Step 5 In the controller to access the value in field "HelloName" the command is String userContent = pageContext.getParameter("HelloName"); In D2k, we used :block.field. In OAFramework, at submission of page, all the field values get passed into to OAPageContext object.
Use getParameter to access the field value To set the value of the field, use
OAMessageTextInputBean field HelloName = (OAMessageTextInputBean)webBean.findChildRecursive("HelloName"); fieldHelloName.setText(pageContext,"Setting the default value" ); Note when setting field value in controller: Note 1. Do not set the value in processFormRequest Note 2. If the field comes from View Object, then do not use setText in controller Note 3. For control fields [that are not based on View Objects], you can use setText to assign values in processRequest method
Contact Us: 002 010 900 160 23 002 0100 62 62 837 In D2K-forms we sort of created a Window, attached to Canvas, and then fields within that Canvas. However in OA Framework, think of Page being fmx/Window, think of Region being a Canvas, and fields being within Regions. This is not a formal/accurate understanding of analogy between D2k and Framework, but is close to being logical. Note 2 In D2k, your Forms fmb file was compiled to fmx. It was fmx file that was deployed on mid-tier. In case of OAF, your OA Page is nothing but a XML file. We call this MDS [meta data]. Whatever name you give to "Page" in OAF, an XML file of the same name gets created. This xml file must then be loaded into database by using XML Importer command. Note 3 Apart from MDS XML file, almost everything else is merely deployed to your mid-tier. Usually this is underneath $JAVA_TOP/oracle/apps/../.. All java files will go underneath java top/oracle/apps/../.. etc. Note 4 When building tutorial, ignore the steps for setting "Attribute Sets". These are not mandatory. Oracle might just have developed their tutorials without including these. Think of these like Visual Attributes of D2K forms Note 5 Controller is where you will write any java code in OA Framework. You can create a Controller per Page or have a different Controller for each of the Regions with the same Page. Note 6 In the method processFormRequest of the Controller, you can access the values of the page by using notation pageContext.getParameter("<fieldname here>"). This method processFormRequest is executed when the OAF Screen/Page is submitted by click of a button. Note 7 Inside the controller, all the Database Related interactions for example Copyright 2013, AppsLead. All rights reserved
Contact Us: 002 010 900 160 23 002 0100 62 62 837 interaction with View Objects happen via Application Module. But why so? Because Application Module Manages the transaction state of the Application. OAApplicationModuleImpl oaapplicationmoduleimpl = OAApplicationModuleImpl)oapagecontext.getApplicationModule(oaweb bean); OADBTransaction oadbtransaction = OADBTransaction)oaapplicationmoduleimpl.getDBTransaction(); Note 8 In D2K, we have control block or a block based on database view. Similarly, in OA Framework, if the field does not have view Object attached, then it is like a control field. Hence in HelloWorld example, field HelloName is a control field [in D2K terminology]. A view Object can either be based on a view/table, synonym or on a SQL statement. Note 9 I wish to access the fields in multi record block that is based on view Object. Can I do this in Controller? Sure you can. To traverse through those records, do the below Get the reference to the View Object using (OAViewObject)oapagecontext.getApplicationModule(oawebbean).findV iewObject("VO Name Here") Loop through the records in View Objects using count returned from oaviewobject.getFetchedRowCount() For each record, fetch the value of the fields within the loop as oracle.jbo.Row row = oaviewobject.getRowAtRangeIndex(loop index here); (String)row.getAttribute("Column name of VO here ");
5. Modify the Page Layout (Top-level) Region Copyright 2013, AppsLead. All rights reserved
Attribute ID Region Style Form Property Auto Footer Window Title Title AM Definition
Property PageLayoutRN pageLayout True True Call D2K from OAF Page Window Title Call D2K from OAF Page Header prajkumar.oracle.apps.fnd.Calld2kformfromOAF.ser ver. Calld2kformfromOAFAM
Attribute Region
Property ButtonLayout
Contact Us: 002 010 900 160 23 002 0100 62 62 837 8. Create a Second Item (Go Button)
Select ButtonLayout > New > Item
9. Add a Controller
Select MainRN right click > Set New Controller Package Name -- prajkumar.oracle.apps.fnd.Calld2kformfromOAF.webui Class Name -- Calld2kformfromOAFCO
DECLARE BEGIN fnd_function.execute ( FUNCTION_NAME =>'CALL_OAF_FROM_D2K', OPEN_FLAG =>'Y', SESSION_FLAG =>'Y', OTHER_PARAMS =>'FIRSTNAME=' || :CALLOAFFROMD2KBLOCK.FIRST_NAME || '&LASTNAME=' || :CALLOAFFROMD2KBLOCK.LAST_NAME ); END;
Note Here FUNCTION_NAME is OAF page function name
8. Add following Code in Controller import oracle.apps.fnd.framework.OAException; ... public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processFormRequest(pageContext, webBean); String firstName = pageContext.getParameter("FIRSTNAME") ; String lastName = pageContext.getParameter("LASTNAME") ; String message = "Hello " + firstName + " " + lastName; Copyright 2013, AppsLead. All rights reserved
5. Modify the Page Layout (Top-level) Region Copyright 2013, AppsLead. All rights reserved
Attribute ID Region Style Form Property Auto Footer Window Title Title AM Definition
Property PageLayoutRN pageLayout True True Get Host and URL Window Title Get Host and URL Page Header prajkumar.oracle.apps.fnd.hostandurl.server.HostandUR LAM
Attribute Region
Property ButtonLayout
Contact Us: 002 010 900 160 23 002 0100 62 62 837 8. Create a Item (Go Button)
Select ButtonLayout > New > Item
9. Add a Controller
Select MainRN right click > Set New Controller Package Name -- prajkumar.oracle.apps.fnd.hostandurl.webui Class Name -- HostandURLCO
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean) { super.processFormRequest(pageContext, webBean); if (pageContext.getParameter("Go") != null) { // To get Host Name try { InetAddress addr = InetAddress.getLocalHost(); byte[ ] ipAddr = addr.getAddress(); String hostname = "Host Name: " +addr.getHostName(); pageContext.putDialogMessage(new OAException(hostname, Copyright 2013, AppsLead. All rights reserved
Contact Us: 002 010 900 160 23 002 0100 62 62 837 OAException.WARNING)); } catch (UnknownHostException e) { } // To Get Page URL String pageURL = "Current Page URL: " + pageContext.getCurrentUrl (); pageContext.putDialogMessage(new OAException(pageURL, OAException.WARNING)); } }
11. Congratulation you have successfully finished. Run Your page and Test Your Work
2. Create a New Application Module (AM) Right Click on FileUploadDemo > New > ADF Business Components > Application Module Name -- FileUploadAM Package -- prajkumar.oracle.apps.fnd.fileuploaddemo.server Check Application Module Class: FileUploadAMImpl Generate JavaFile(s)
3. Create a New Page Right click on FileUploadDemo > New > Web Tier > OA Components > Page Name -- FileUploadPG Package -- prajkumar.oracle.apps.fnd.fileuploaddemo.webui
4. Select the FileUploadPG and go to the strcuture pane where a default region has been created
Attribute ID
Property PageLayoutRN
AM Definition
prajkumar.oracle.apps.fnd.fileuploaddemo.server.FileUploa dAM Uploading File into Server from Local Machine Demo Window Uploading File into Server from Local Machine Demo
Window Title
Title
6. Create messageComponentLayout Region Under Page Layout Region Right click PageLayoutRN > New > Region
7. Create a New Item messageFileUpload Bean under MainRN Right click on MainRN > New > messageFileUpload Set Following Properties for New Item --
8. Create a New Item Submit Button Bean under MainRN Right click on MainRN > New > messageLayout Set Following Properties for messageLayout --
Attribute
Property
ID
ButtonLayout
9. Create Controller for page FileUploadPG Right Click on PageLayoutRN > Set New Controller Package Name: prajkumar.oracle.apps.fnd.fileuploaddemo.webui Class Name: FileUploadCO
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean) { super.processFormRequest(pageContext, webBean); if(pageContext.getParameter("Submit")!=null) { upLoadFile(pageContext,webBean); } }
CODE #2 -- If Page has been Deployed at Instance, Use Following Code public void upLoadFile(OAPageContext pageContext,OAWebBean webBean) { String filePath = "/u01/app/apnac03r12/PRajkumar/"; System.out.println("Default File Path---->"+filePath); String fileUrl = null; try { DataObject fileUploadData = pageContext.getNamedDataObject("MessageFileUpload"); //FileUploading is my MessageFileUpload Bean Id if(fileUploadData!=null) { String uFileName = (String)fileUploadData.selectValue(null, "UPLOAD_FILE_NAME"); String contentType = (String) fileUploadData.selectValue(null, "UPLOAD_FILE_MIME_TYPE"); System.out.println("User File Name---->"+uFileName); FileOutputStream output = null; InputStream input = null; BlobDomain uploadedByteStream = (BlobDomain)fileUploadData.selectValue(null, uFileName); System.out.println("uploadedByteStream---->"+uploadedByteStream); File file = new File("/u01/app/apnac03r12/PRajkumar", uFileName); System.out.println("File output---->"+file); output = new FileOutputStream(file); System.out.println("output----->"+output); input = uploadedByteStream.getInputStream(); System.out.println("input---->"+input); byte abyte0[] = new byte[0x19000]; int i; while((i = input.read(abyte0)) > 0) output.write(abyte0, 0, i);
10. Congratulation you have successfully finished. Run Your page and Test Your Work
Page has not been deployed and Used CODE #1 Before Upload the File
1. Deploy your JAR file at some custom location in R12 server i.e. /u01/app/apnac03r12/XX_TEST/
2. Add JAR file jxl-2.6.3.jar to Apache Library Download jxl-2.6.3.jar from following link http://www.findjar.com/jar/net.sourceforge.jexcelapi/jars/jxl-2.6.jar.html
Steps to add jxl.jar file in Local Machine Right Click on ImportxlsDemo > Project Properties > Libraries > Add jar/Directory and browse to directory where jxl-2.6.3.jar has been downloaded and select the JAR file
Click here to know Steps to Add JAR file into R12 server in OA
3. Create a New Application Module (AM) Right Click on ImportxlsDemo > New > ADF Business Components > Application Module Name -- ImportxlsAM Package -- prajkumar.oracle.apps.fnd.importxlsdemo.server
5. Create a New Entity Object (EO) Right click on ImportxlsDemo > New > ADF Business Components > Entity Object Name ImportxlsEO Package -- prajkumar.oracle.apps.fnd.importxlsdemo.schema.server Database Objects -- XX_IMPORT_EXCEL_DATA_DEMO
Note By default ROWID will be the primary key if we will not make any column to be primary key Check the Accessors, Create Method, Validation Method and Remove Method
6. Create a New View Object (VO) Right click on ImportxlsDemo > New > ADF Business Components > View Object Name -- ImportxlsVO Package -- prajkumar.oracle.apps.fnd.importxlsdemo.server
In Java page Uncheck Generate Java file for View Object Class: ImportxlsVOImpl Select Generate Java File for View Row Class: ImportxlsVORowImpl -> Generate Java File -> Accessors
7. Add Your View Object to Root UI Application Module Right click on ImportxlsAM > Edit ImportxlsAM > Data Model > Select ImportxlsVO and shuttle to Data Model list
8. Create a New Page Right click on ImportxlsDemo > New > Web Tier > OA Components > Page Name -- ImportxlsPG Package -- prajkumar.oracle.apps.fnd.importxlsdemo.webui
9. Select the ImportxlsPG and go to the strcuture pane where a default region has been created
Attribute ID AM Definition
Property PageLayoutRN prajkumar.oracle.apps.fnd.importxlsdemo.server.Importxls AM Import Data From Excel through OAF Page Demo Window Import Data From Excel through OAF Page Demo
11. Create messageComponentLayout Region Under Page Layout Region Right click PageLayoutRN > New > Region
12. Create a New Item messageFileUpload Bean under MainRN Right click on MainRN > New > messageFileUpload Set Following Properties for New Item --
13. Create a New Item Submit Button Bean under MainRN Right click on MainRN > New > messageLayout Set Following Properties for messageLayout --
Attribute ID
Property ButtonLayout
14. Create Controller for page ImportxlsPG Right Click on PageLayoutRN > Set New Controller Package Name: prajkumar.oracle.apps.fnd.importxlsdemo.webui Class Name: ImportxlsCO
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean) { super.processFormRequest(pageContext, webBean); if (pageContext.getParameter("Go") != null) { DataObject fileUploadData = (DataObject)pageContext.getNamedDataObject("MessageFileUpload"); String fileName = null; try { fileName = (String)fileUploadData.selectValue(null, "UPLOAD_FILE_NAME"); } catch(NullPointerException ex) {
Row row = vo.createRow(); try { for (int i=0; i < excel_data.length; i++) { row.setAttribute("Column" +(i+1) ,excel_data[i]); } } catch(Exception e) { System.out.println(e.getMessage()); } vo.insertRow(row); getTransaction().commit(); } public void ReadExcel(BlobDomain fileData) throws IOException { String[] excel_data = new String[5]; InputStream inputWorkbook = fileData.getInputStream(); Workbook w; try { w = Workbook.getWorkbook(inputWorkbook); // Get the first sheet Sheet sheet = w.getSheet(0); for (int i = 0; i < sheet.getRows(); i++) { for (int j = 0; j < sheet.getColumns(); j++) { Cell cell = sheet.getCell(j, i); CellType type = cell.getType(); if (cell.getType() == CellType.LABEL) { System.out.println("I got a label " + cell.getContents()); excel_data[j] = cell.getContents(); } else if (cell.getType() == CellType.NUMBER) { System.out.println("I got a number " + cell.getContents());
15. Congratulation you have successfully finished. Run Your page and Test Your Work
2. ooxml-schemas-1.1.jar http://mvnrepository.com/artifact/org.apache.poi/ooxml-schemas/1.1
3. stax-api-1.0.1.jar http://www.jarfinder.com/index.php/jars/versionInfo/69009
4. log4j-1.2.16.jar http://mvnrepository.com/artifact/log4j/log4j/1.2.16
5. poi-ooxml-schemas-3.7.jar http://mavenhub.com/mvn/central/org.apache.poi/poi-ooxml-schemas/3.7
6. poi-3.7-20101029.jar http://mvnrepository.com/artifact/org.apache.poi/poi/3.7-beta1
8. dom4j-1.6.1.jar http://grepcode.com/snapshot/repo1.maven.org/maven2/dom4j/dom4j/1.6.1
Steps to add JAR files in Local Machine Right Click on ImportxlsDemo > Project Properties > Libraries > Add jar/Directory and browse to directory where all JAR files have been downloaded and select the JAR files
Click here to know Steps to Add JAR file into R12 server in OA
3. Create a New Application Module (AM) Right Click on ImportxlsDemo > New > ADF Business Components > Application Module Name -- ImportxlsAM Package -- prajkumar.oracle.apps.fnd.importxlsdemo.server Check Application Module Class: ImportxlsAMImpl Generate JavaFile(s)
4. Create Test Table in which we will insert data from *.xlsx file CREATE TABLE xx_import_excel_data_demo
DATE NOT NULL, NUMBER NOT NULL, DATE NOT NULL, NUMBER NOT NULL, NUMBER
);
5. Create a New Entity Object (EO) Right click on ImportxlsDemo > New > ADF Business Components > Entity Object Name ImportxlsEO Package -- prajkumar.oracle.apps.fnd.importxlsdemo.schema.server Database Objects -- XX_IMPORT_EXCEL_DATA_DEMO
Note By default ROWID will be the primary key if we will not make any column to be primary key
Check the Accessors, Create Method, Validation Method and Remove Method
6. Create a New View Object (VO) Right click on ImportxlsDemo > New > ADF Business Components > View Object Name -- ImportxlsVO Package -- prajkumar.oracle.apps.fnd.importxlsdemo.server
In Java page Select Generate Java File for View Object Class: ImportxlsVOImpl -> Generate Java File -> Bind Variable Accessors Select Generate Java File for View Row Class: ImportxlsVORowImpl -> Generate Java File -> Accessors
7. Add Your View Object to Root UI Application Module Right click on ImportxlsAM > Edit ImportxlsAM > Data Model > Select ImportxlsVO and shuttle to Data Model list
8. Create a New Page Right click on ImportxlsDemo > New > Web Tier > OA Components > Page Name -- ImportxlsPG Package -- prajkumar.oracle.apps.fnd.importxlsdemo.webui
9. Select the ImportxlsPG and go to the strcuture pane where a default region has been created
Attribute ID AM Definition
Property PageLayoutRN prajkumar.oracle.apps.fnd.importxlsdemo.server.Importxls AM Import Data From Excel(*.xlsx) through OAF Page Demo Window Import Data From Excel(*.xlsx) through OAF Page Demo
Window Title
Title
11. Create messageComponentLayout Region Under Page Layout Region Right click PageLayoutRN > New > Region
12. Create a New Item messageFileUpload Bean under MainRN Right click on MainRN > New > messageFileUpload Set Following Properties for New Item --
13. Create a New Item Submit Button Bean under MainRN Right click on MainRN > New > messageLayout Set Following Properties for messageLayout --
Attribute ID
Property ButtonLayout
14. Create Controller for page ImportxlsPG Right Click on PageLayoutRN > Set New Controller Package Name: prajkumar.oracle.apps.fnd.importxlsdemo.webui Class Name: ImportxlsCO
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean) { super.processFormRequest(pageContext, webBean); OAApplicationModule am = pageContext.getApplicationModule(webBean); if (pageContext.getParameter("Go") != null) { DataObject fileUploadData = (DataObject)pageContext.getNamedDataObject("MessageFileUpload"); String fileName; try { fileName = (String)fileUploadData.selectValue(null, "UPLOAD_FILE_NAME"); } catch(NullPointerException ex) {
try { OAApplicationModule oaapplicationmodule = pageContext.getRootApplicationModule(); Serializable aserializable2[] = {uploadedByteStream}; Class aclass2[] = {BlobDomain.class }; oaapplicationmodule.invokeMethod("ReadExcel", aserializable2,aclass2); } catch (Exception ex) { throw new OAException(ex.toString(), OAException.ERROR); } } }
public void createRecord(String[] excel_data) { ImportxlsVOImpl vo = (ImportxlsVOImpl)getImportxlsVO1(); vo.InsertRecord(excel_data); getTransaction().commit(); } public void ReadExcel(BlobDomain fileData) throws IOException { try
15. Congratulation you have successfully finished. Run Your page and Test Your Work
2. Compile all java files (Controller Files) with command javac <file_name>.java 3, Call java importer to import all xml files java oracle.jrad.tools.xml.importer.XMLImporter $JAVA_TOP/prajkumar/oracle/apps/fnd/webui/HelloWorldPG.xml -username apps -password apps -dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp) (HOST= <name of HOST>)(PORT=<port_number>)) (CONNECT_DATA=(SID=<SID_NAME>)))" -rootdir $JAVA_TOP
4. Print
jdr_utils.printDocument('/prajkumar/oracle/apps/fnd/webui/HelloWorldPG',1000) Example DECLARE BEGIN jdr_utils.printDocument('/prajkumar/oracle/apps/fnd/webui/HelloWorldPG',1000); EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE(SQLERRM); END; 5. Create form function with property "SSWA jsp function" and webhtml "OA.jsp? page=/prajkumar/oracle/apps/fnd/webui/HelloWorldPG"
Profile Name FND: Personalization Region Link Enabled Personalize Self-Service Defn Disable Self-Service Personal
Let us try to Extend Controller in OAF Page Create one search page as explained in below link https://blogs.oracle.com/prajkumar/entry/create_oaf_search_page In this exercise I am going to extend CO of SearchPG. First lets create CO for SearchPG. Right Click PageLayoutRN under SearchPG page > Set New Controller Package Name -- prajkumar.oracle.apps.fnd.searchdemo.webui Class Name -- SearchCO Now we will extend this newly created CO under this exercise. The purpose of this exercise is to modify the VO query of results table. I have changed theColumn1 and Column2 fields Property Selective Search Criteria as False. Now when we click on Go button all the records are displaying in the results table and our OBJECTIVE is to bind the VO query of results table in such a way that in result Column1 valueval5 and Column2 value val6 should not come as result on click Go button
Now for knowing which controller to extend we click on "About This Page" Link and select Expand All. Here we can see the Name of the controller that we need to
extend
1. Create a New Workspace and Project File > New > General > Workspace Configured for Oracle Applications File Name PrajkumarCOExtensionDemo
2. Create a New Java Class Right Click on COExtensionDemo > New > General > Java Class Name -- ExtendedCO Package -- prajkumar.oracle.apps.fnd.coextensiondemo.server Extends -- prajkumar.oracle.apps.fnd.searchdemo.webui.SearchCO
3. Write below logic in ExtendedCO Java Class package prajkumar.oracle.apps.fnd.coextensiondemo.webui; import prajkumar.oracle.apps.fnd.searchdemo.webui.SearchCO; import import import import import oracle.apps.fnd.framework.webui.OAPageContext; oracle.apps.fnd.framework.webui.beans.OAWebBean; oracle.apps.fnd.framework.OAApplicationModule; oracle.apps.fnd.framework.webui.beans.layout.OAQueryBean; prajkumar.oracle.apps.fnd.searchdemo.server.SearchVOImpl;
public class XXItemSearchCO extends ItemSearchCO { public XXItemSearchCO() { } public void processFormRequest(OAPageContext pageContext, OAWebBean webBean) { super.processFormRequest(pageContext, webBean);
4. Attach new controller to SearchPG through personalization Click on Personalize Page link on top right hand side of your page
Note -- If you are not able to see this link then go through below link https://blogs.oracle.com/prajkumar/entry/how_to_enable_personalization_link
Click on Complete View -> Expand All -> Click on personalize icon next to Page Layout
Now at site level give the path of extended controller as we are extending the controller atSITE LEVEL prajkumar.oracle.apps.fnd.coextensiondemo.webui.ExtendedCO
5. Congratulation you have successfully finished. Run Your SearchPG page and Test Your Work
Click Go Note Record with Column1 value val5 and Column2 value val6 is not coming in result
Why we are extending AM:This InsertAM contains an apply method which subsequently commits the transaction.
Here is Audit Table script -CREATE TABLE xx_audit ( -- -------------------- Data Columns -- -------------------user_id VARCHAR(50), user_name VARCHAR(50), -- -------------------- Who Columns -- ------------------last_update_date DATE NOT NULL, last_updated_by NUMBER NOT NULL, creation_date DATE NOT NULL, created_by NUMBER NOT NULL, last_update_login NUMBER );
Write following code in ExtendedAMImpl.java import oracle.apps.fnd.framework.OAException; import java.sql.PreparedStatement; import java.sql.Connection; public class ExtendedAMImpl extends InsertAMImpl { .... public void apply() { java.sql.Date d = getOADBTransaction().getCurrentDBDate().dateValue(); try { Connection conn = getOADBTransaction().getJdbcConnection(); String Query = "insert into xx_audit values(:1,:2,:3,:4,:5,:6,:7)"; PreparedStatement stmt = conn.prepareStatement(Query); stmt.setInt(1, getOADBTransaction().getUserId()); stmt.setString(2, getOADBTransaction().getUserName());
3. After substitution it will modify *.jpx In our case it will modify InsertDemo.jpx at project location i.e. -- D:\xxxx\jdevhome\jdev\myclasses
4. Migrate/ Import the modified jpx Open Command Prompt and go to following location of your projectD:\xxxx\jdevbin\oaext\bin
5. Congratulation you have successfully finished. Run Your InsertPG page and Test Your Work
We are going to extend SearchVO of SearchPG page. Our business requirement is to addCreation Date attribute in the results table region
1. Analyze the Page Click on About this Page link to check that which ViewObject is associated with the table region [ResultsRN]
Here we can see that results table has SearchVO attached to it. Now click on Business Component Reference details and check the path of SearchVO
Now click on SearchVO which is an EO based [SearchEO] to check whether it has Creation Date attribute or not which we want to add
Here we can see that our VO does not have CreationDate attribute. So for adding this attribute we need to perform VO Extension. FTP this project from application server and open in JDeveloper
2. Create a New View Object (VO) Right click on SearchDemo > New > ADF Business Components > View Object
The next screen allows the addition or deletion of Entity Objects. No change is required here for this extension so simply select Next
The next pane allows additional attributes to be added or attributes to be removed. In this case add CreationDate attributes to the selected list
Note -- Please note the new attribute you would be adding will be coming as Transient
Modify above SQL statement with below SQL to add new attribute CREATION_DATE
Click Finish
Note -- Now as our attribute created as Transient hence to fix this issue we have two options: 1. We need to correct our XML file generated as it is a known error with Jdeveloper 2. Double click on that attribute i.e CreationDate and in the View Object Attribute window, enter attribute name in 'Expression' column i.e. CreationDate
Lets try first method -Open your ExtSearchVO.xml file in some notepad editor. Scroll to bottom of that file Update
with
3. Substitute your New VO with parent VO Right click on SearchDemo > Project Properties > Business Components > Substitutions In Available list select SearchVO and in Substitute list select New VO ExtSearchVO and click on Add and then Ok
4. After substitution import *.jpx In our case it will modify SearchDemo.jpx at project location i.e. --D:\xxxx\jdevhome\jdev\myclasses Open Command Prompt and go to following location of your project D:\xxxx\jdevbin\oaext\bin
5. Personalize the page to create new item On SearchPG click on Personalize Page link
Set item style as messageStyledText Set Following Properties Id CreationDateId Data Type -- Date Prompt Creation Date View Instance ExtSearchVO1 View Attribute CreationDate
We are going to extend InsertEO. Our business requirement is to add Validation on Column1. The length of entered data in Column1 should be more than 5 Characters.
2. Create a New Entity Object (EO) Right click on InsertDemo > New > ADF Business Components > Entity Object
import oracle.apps.fnd.framework.OAException; protected void validateEntity() { super.validateEntity(); String column1Value = getColumn1(); if (column1Value.length() < 5) { String message = "Length of String" + " " + column1Value + "is less than 5 characters"; throw new OAException(message, OAException.INFORMATION); } }
5. After substitution import *.jpx In our case it will modify InsertDemo.jpx at project location i.e. -- D:\xxxx\jdevhome\jdev\myclasses
7. Verify the substitution has applied properly Run InsertPG page and click on About this Page link
Expand Business Component References Details Under that section click on InsertVO which is EO based [it should be ExtInsertEO based]
8. Congratulation you have successfully finished. Run Your InsertPG page and Test Your Work
process request, do it conditionally. Let it not get executed every time the process request is called. Ex: if(fromPage == CorrectPage) { vo.executeQuery(); } This avoids duplicate data or data loss whenever your page is rendered from a dialog page or back button etc. If you want any values of your CO to be available in your EO, put those values in transaction. Do this only if it is very much required. Should not create unnecessary transactions anywhere. Only get the already existing transaction object from AM using getTransaction() Method. Make it a point to remove all the session parameters and transaction parameters soon after their utilization. Should be very careful with session parameters because they result in unnecessary data and its often difficult to debug. Passing too many parameters through hashmap not only effects the performance but it also effects the UI Avoid writing huge code in CO. No business logic should be written in the CO or AM. Try creating private methods in controller wherever you have redundant code. Create separate interface per module for declaring all your constant variables rather than hardcoding the values in the code. Ex : You want to use a lookup name n number of times in your coding. Instead of hardcoding it everywhere, declare it in your constants interface and use the constant in your code. Tomorrow, If you have to change the lookup, you can change it at a single place (in the constants interface) and save time. Whenever you have to get or set values of a VO use
get/set<Attribute_name> method instead of getAttribute(index) method. Because the getAttribute(index) traverses through the entire attributeset in order to find the required attribute which is a performance issue Ex: Say, you have an attribute called SelectFlag with attribute index as n . To get the value, use getSelectFlag instead of getAttribute(n). HGrid cache: Hgrid is one of the components in OAF which gives major surprises to the developer everytime. Should be very careful while creating the viewlink. Remember to clear the cache of the hgrid each time the hgrid is rendered or the hgrid query is executed. Syntax : hgridBean.clearCache(); To expand the hgrid upto nth level by default (i.e to expand the tree structure upto nth child), use the following syntax : hgridBean.setAutoExpansionMaxLevels(n); Better to call sequences from the create method of EO rather than calling them from custom methods in AM. Infact, set all the default values or who columns for attributes here only. Always reset a VO before iterating it. Especially when getting the values of a radio button selection etc. Ex : vo.reset(); while(vo.hasNext()){ // get handle of the vos current row and perform ur operations; // break the loop after reaching the last record of the current rowset. } Set any VOs where clause and where clause params in VOImpl class rather than creating directly in CO. This increases reusability and modularity. But you dont have to set any where clause or where clause params and should directly execute the query, then need not use VOImpl for calling the executeQuery() method. Exception Handling : Proper exception handling is a must. Put your
Copyright 2013, AppsLead. All rights reserved
code in proper try catch blocks wherever possible. If your code ,which is in try-catch block, have to throw OAException anywhere, that will be caught and will not be shown to the user. Hence use the following statement in the catch block to throw the OAExceptions to the user : try{ throw new OAException(APP_CODE, ERROR_MSG); }catch(Exception _exception) { throw OAException.wrapperException(_exception); } Use the following syntax for logging your exception in the log file if(pageContext.isLoggingEnabled(4)) { pageContext.writeDiagnostics(getClass().getName() +.processFormRequest, Exception Details : , 4); } Do not catch your exceptions wherever they occurred (ex in AM). The exception must always be thrown back to the calling method . So all the exceptions must be finally caught in the CO. Calling AM methods in CO : Those of you who have used invokeMethod() in CO to call the AM methods might have observed that its the most tedious way of calling methods, especially when you have to send serialized parameters. Importing the AMImpl class in your controller allows you to access the AM methods directly without the use of invokeMethod() but it breaks the basic OAF standards coz u r accessing a class in the server package from a class in the webui package. To overcome the above, the best practice is to create an Interface of the AMImpl (which neither belongs to server nor webui) and use this AM Interface in your CO rather than AMImpl class. To create an interface in Jdeveloper, double click on the AM , select client methods and shuttle the required methods to right side. It automatically creates an interface for you with the selected methods. Example for getting the object of the interface :
When you add a query region to a pageLayout region, OA Framework automatically generates an oracle.apps.fnd.framework.webui.beans.layout.OAQueryBean which, depending on its configuration, works in concert with a child table, advanced table or HGrid to implement any combination of simple search, advanced search and view panels. OA Framework automatically generates buttons as appropriate for toggling between the applicable regions. Construction Modes: There are three construction modes available. In the above example we have used resultBasedSearchconstruction mode. Here is a brief comparison of the three modes. 1] resultsBasedSearch: OA Framework automatically renders both the Simple and Advanced search regions based on the designated queryable items in the associated table. The search regions automatically include both a Go and a Clear button. OA Framework automatically executes the underlying search when the user selects the Go button. OA Framework automatically renders both the Simple and Advanced search regions based on the corresponding Simple search and Advanced search regions that you define and specify as named children of the query region. The search regions automatically include a Go button. In addition, the Advanced search region includes a Clear button. OA Framework automatically executes the underlying search when the user selects the Go button. However, developers must explicitly define mappings between items in the Search panel and items in the table region. 3] none The Search regions are rendered based on the Simple Search and Advanced Search regions that you define and specify as named children of the query region. You must implement your own Go button in this mode. The underlying search must be executed by the developer.
2] autoCustomizationCriteria:
You can explicitly display a message box of any type using the following code in your controller.
1 OAException message = new OAException("You cannot create a new change order when a Draft version already exits.",OAException.ERROR); 2 pageContext.putDialogMessage(message);
Here you need to construct an oracle.apps.fnd.framework.OAException object and set the kind of message you want (other options are OAException.WARNING, OAException.INFORMATION and OAException.CONFIRMATION). Then you can simply identify this exception for display when the page renders by calling the OAPageContext.putDialogMessage() method.
If after you call putDialogMessage() in your processFormRequest() method you want to forward to the current page or another page and display the message at the top of the new target page, you need to call the appropriate oracle.apps.fnd.framework.webui.OAPageContext forwardImmediately*() method. The OA Framework immediately stops processing the page and issues a forward before displaying the messages. You can register or throw multiple exceptions; the OA Framework combines them into a single message box using the following rules:
Since an error is more important than a warning, the message box is titled Error if both errors and warnings exist. Confirmations and errors cannot be shown together. In this case, the OA Framework simply ignores the confirmation message(s). You can, however, show confirmations with warnings. The message box is titled Confirmation, and it contains both types of messages.
The OADialogPage class holds properties for the generic dialog page. To create a dialog page object, first use the constructors to instantiate the basic properties, then use the setter methods provided in the class to set additional properties. To navigate (redirect) to a dialog page, use the OAPageContext.redirectToDialogPage methods. The OAPageContext interface contains the context and state information specific for a client request.
01 // To Diaplay the Exception on a Dialog page 02 OAException message = new OAException("You cannot create a new change order when a Draft version already exits."); 03 OADialogPage dialogPage = new OADialogPage(OAException.ERROR, message, null,"",null); 04 05 dialogPage.setOkButtonToPost(true); 06 dialogPage.setOkButtonLabel("Ok"); 07 08 dialogPage.setPostToCallingPage(true); 09 java.util.Hashtable formParams = new java.util.Hashtable(1); 10 dialogPage.setFormParameters(formParams); 11 pageContext.redirectToDialogPage(dialogPage);
If you want 2 buttons (Say Cancel and Ok), then put instead of null in the OADialogPage dialogPage = new OADialogPage line.
1 java oracle.jrad.tools.xml.exporter.XMLExporter \
1 java oracle.jrad.tools.xml.importer.XMLImporter \ 2 <full path of the file you want to import> \ 3 -username "<username>" -password "<password>" \ -dbconnection "(description=(address_list=(address=(protocol=tcp) 4 (host=<host>)(port=<port>)))(connect_data=(sid=<sid>)))" -rootdir "<top level directory>" \ 5 -rootPackage "/oracle/apps/<prod>"
Example:
1 java oracle.jrad.tools.xml.importer.XMLImporter \ 2 $XXSCM_TOP/install/ReqLinesNotificationsRN.xml \ 3 -username apps -password w3lcome123 \ -dbconnection "(description=(address_list=(address=(protocol=tcp)(host= 4 myhost)(port=12345)))(connect_data=(sid=dev)))" -rootdir "$XXSCM_TOP/install" \ 5 -rootPackage "oracle/apps/icx/por/wf/server"