Now that we can insert data from OAF screen as explained in Insert Record article. We need a way to search them for the most obvoious reasons. Below are the steps that explain to the same from an OAF page.
Requirement: To search records in a table from OAF screen
Step 1: Create a new OA workspace and OA project
Create a OA workspace with file name as: SearchRecord
Create a OA project with file name as: SearchRecord
Default package: oaf.oracle.apps.fnd.searchrecord
Once your project is created, double click on SearchRecord project and select Project content.
Click on 'Add' button next to the bottom pane in the Project content and select only that package which you want have in your project.
Click OK and save your project.
Step 2: Create a ADF Business component - Application Module AM
Right click on InsertRecord project -> click New -> select ADF Business components -> select Application Module
Package: oaf.oracle.apps.fnd.searchrecord.server
AM Name: SearchRecordAM
Check Application Module Class: SearchRecordAMImpl Generate Java File(s)
Once the AM is created, double click on the AM just created and in the window that opens select Custom Properties and set the values as below, click on Apply and then Ok.
Step 3: Create a OA Components page
Right click on SearchRecord project -> click New -> select OA components under Web Tier -> select Page
Package: oaf.oracle.apps.fnd.searchrecord.webui
Page Name: SearchRecordPG
Step 4: Set Page properties
Select on the SearchRecordPG page and go to structure pane where a region of type 'pageLayout' and ID 'region1' is automatically created.
Click on region1 in structure page and set the project properties as in the below screenshot - set all the properties except the controller class, for now.
Step 5: Set new Controller
Select PageLayoutRN in the structure pane -> Right click on it -> Set new controller
Package: oaf.oracle.apps.fnd.searchrecord.webui
Controller name: SearchRecordCO
This automatically sets the controller class property in SearchRecordPG page properties.
Step 6: Insert values into insertrecord table created in InsertRecord article:
INSERT INTO insertrecord VALUES ('ijk', 'lmn', SYSDATE, 0, SYSDATE, 0, 0);
INSERT INTO insertrecord VALUES ('opq', 'rst', SYSDATE, 0, SYSDATE, 0, 0);
INSERT INTO insertrecord VALUES ('uvw', 'xyz', SYSDATE, 0, SYSDATE, 0, 0);
INSERT INTO insertrecord VALUES ('val1', 'val2', SYSDATE, 0, SYSDATE, 0, 0);
Step 7: Create a ADF Business component - Entity Object
Right click on SearchRecord project -> New -> ADF Business Components -> Entity Object
Name -> SearchRecordEO
Package: oaf.oracle.apps.fnd.searchrecord.schema.server
Database Object: INSERTRECORD
ROWID will be the default primary key if the table has no primary key. Check the Accessors, Create Method, Validation Method and Remove Method.
Step 8: Create a ADF Business component - View Object
Right click on SearchRecord project -> click New -> select ADF Business components -> select View Object
Package: oaf.oracle.apps.fnd.searchrecord.server
VO Name: SearchRecordVO
In the Step 2, select SearchRecordEO and shuttle them to selected list
In Step3, from the Attributes window select columns Column1, Column2 and shuttle them to selected list.
In step-8(Java) of VO creation uncheck all the pre-selected checkboxes and select View Row Class: ViewObjRowImpl -> Generate Java File -> Accessors check box Accept all other defaults in VO creation, click Finish to create the VO under the package specified.
Step 9: Attach VO to AM
After creating VO successfully, we must associate this VO with AM we have created
Right click on SearchRecordAM -> Edit SearchRecordAM
Select 'Data Model' on the window that pops up
You should find SearchRecordVO listed in the left panel, Shuttle the SearchRecordVO to the right pane to associate it with the SearchRecordAM which is displayed as SearchRecordVO1 as in the below screenshot
Click on Apply and OK to save the changes made to SearchRecordAM
Step 10: Create layout in SearchRecordPG
Right click on PageLayoutRN -> New -> Region
Now, this creates a new region of style header under PageLayoutRN
Select region1 - set the ID as QueryRN and set the region style to query
Set the properties of QueryRN as in the below screenshots:
Step 11: Create table in QueryRN
Right click on QueryRN > New > Region using Wizard..
During creation, Choose the AM and the associated VO :
Set the column properties during table creation as in the below screenshot:
Set the properties of the table itself as in screenshots below:
Set the properties of the columns Column1 and Column2 as below:
Column1: Column2:
Result:
On page load:
You can Search for data:
Comments
RSS feed for comments to this post