Showing posts with label Oracle Apps Framework (OAF). Show all posts
Showing posts with label Oracle Apps Framework (OAF). Show all posts

Create Auto Customization Criteria OAF Search Page


Create Auto Customization Criteria OAF Search Page


1. Create a New Workspace and Project
Right click Workspaces and click create new OAworkspace and name it as PRajkumarCustSearch. Automatically a new OA Project will also be created. Name the project as CustSearchDemo and package as prajkumar.oracle.apps.fnd.custsearchdemo

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,
    creation_date          DATE         NOT NULL,
    created_by               NUMBER   NOT NULL,
    last_update_login   NUMBER
 );

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
Select new region region1 and set following properties
ID – QueryRN
Region Style – query
Construction Mode – autoCustomizationCriteria
Include Simple Panel – False
Include Views Panel – False
Include Advanced Panel – False

12. Create a New Region of style table
Right Click on QueryRN > New > Region Using WizardApplication 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) createdSet Following Properties for region2
Id – SimpleSearchHeader
Text -- Simple Search

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






Create Data Entry OAF Page


Create Data Entry OAF Page


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
Item Style -- messageTextInput
Maximum Length -- 100
Length -- 20
Prompt -- Column2
View Instance -- InsertVO1
View Attribute – 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.

14. Implement Row Initialization (Create a View Object Row)
Add createRecord method to your InsertAMImpl class
import oracle.jbo.Row;
import oracle.apps.fnd.framework.OAViewObject;
...
  
public void createRecord()
{
  OAViewObject vo = (OAViewObject)getInsertVO1();
 
  if (!vo.isPreparedForExecution()) 
  { 
 vo.executeQuery(); 
  }
 
  Row row = vo.createRow();
  vo.insertRow(row);
  row.setNewRowState(Row.STATUS_INITIALIZED);
} 
 
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 oracle.jbo.domain.Number; 
import oracle.apps.fnd.common.MessageToken;
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.framework.OAViewObject;
import 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) 
                          };
 
  OAException confirmMessage = new OAException( "FND",
                                 "TEST_CREATE_CONFIRM", tokens,
                                 OAException.CONFIRMATION, null);
   
  pageContext.putDialogMessage(confirmMessage);
  pageContext.forwardImmediately(
   "OA.jsp?page=/prajkumar/oracle/apps/fnd/insertdemo/webui/InsertPG",
    null, OAWebBeanConstants.KEEP_MENU_CONTEXT,
    null,
    null,
    true, // retain AM
    OAWebBeanConstants.ADD_BREAD_CRUMB_NO);
 }
}
 
 

19. Congratulations you have successfully created data insert page. Run InsertPG page to test Your Work











Implement PopList in OA Framework


Implement PopList in OA Framework


1. Create a New Workspace and Project
File> New > General> Workspace Configured for Oracle Applications
File Name -- PopListDemo
Project Name – PopListDemo
Default Package -- prajkumar.oracle.apps.fnd.poplistdemo

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

SELECT  'poplist_item1' poplist_items
FROM     DUAL
UNION
SELECT  'poplist_item2'
FROM     DUAL
UNION
SELECT  'poplist_item3'
FROM     DUAL

4. Create a New Page
Right click on PopListDemo > New > Web Tier > OA Components > Page
Name -- poplistdemoPG
Package -- prajkumar.oracle.apps.fnd.poplistdemo.webui

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
CSS Class – OraFieldText
Prompt – My PopList

10. Congratulation you have successfully finished. Run Your page and Test Your Work




Implement Dependent LOV in OA Framework


Implement Dependent LOV in OA Framework


Let us try to create a Dependent LOV. In this exercise first Lov Input is “Employee Name” based on Employee Name Second Lov Input will give “Dependent Name”

1. Create a New Workspace and Project
Right click Workspaces and click create new OAworkspace and name it as PRajkumarDependentLovDemo.
Automatically a new OA Project will be created. Name the project as DependentLovDemo and package as prajkumar.oracle.apps.fnd.dependentlovdemo

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


Create First LOV Region for VO DependentLovVO1

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 public and makes it usable in multiple pages

7. Right click on FirstLovRN and click table using wizard. In the wizard choose the prajkumar.oracle.apps.fnd.dependentlovdemo.server.DependentLovAM and select DependentLovVO1_1. Click Next


Region Id – FirstLovRN
Region style – table


8. Shuttle the two attributes to the right side.That is PersonId and FullName


9. Set Region Item properties as below –


ID
Prompt
Style
Datatype
PersonId_LOV
PersonId
formValue
NUMBER
FullName_LOV
FullName
messageStyledText
VARCHAR2


10. Click Next and Finish

11. Select PersonId_LOV and Set Following Properties –

Attribute
Property
Search Allowed
False
Selective Search Criteria
False

12. Select FullName_LOV and Set Following Properties –

Attribute
Property
Search Allowed
True
Selective Search Criteria
False

Now Same way Create Second LOV Region for VO DependentLovVO2

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.DependentLovAM and select DependentLovVO2_1. Click Next


Region Id – SecondLovRN
Region style – table


15. Shuttle the two attributes to the right side.That is PersonId and FullName


16. Set Region Item properties as below –

ID
Prompt
Style
Datatype
Second_PersonId_LOV
PersonId
messageStyledText
NUMBER
Second_FullName_LOV
FullName
messageStyledText
VARCHAR2



17. Click Next and Finish

18. Select Second_PersonId_LOV and Set Following Properties –

Attribute
Property
Search Allowed
False
Selective Search Criteria
True

19. Select Second_FullName_LOV and Set Following Properties –

Attribute
Property
Search Allowed
True
Selective Search Criteria
False

20. Create a New Page
Right click on DependentLovDemo > New > Web Tier > OA Components > Page

Attribute
Property
Name
DependentLovPG
Package
prajkumar.oracle.apps.fnd.dependentlovdemo.webui

21. Select the DependentLovPG and go to the strcuture pane where a default region has been created

22. Select region1 and set the following properties:

Attribute
Property
ID
PageLayoutRN
AM Definition
prajkumar.oracle.apps.fnd.dependentlovdemo.server.DependentLovAM
Window Title
Dependent List of values Demo Window
Title
Dependent List of values Demo

23. Right click PageLayoutRN and  click new Region

Attribute
Property
ID
MainRN
Region Style
messageComponentLayout

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 –

Attribute
Property
ID
ParentPersonId
Item Style
formValue
Data Type
Number

Build First LOV on Page:

25. Right click the MainRN and click new messageLovInput
Set Following Properties for Newly Created messageLovInput

Attribute
Property
ID
Employee_Name
External Lov
/prajkumar/oracle/apps/fnd/dependentlovdemo/webui/FirstLovRN
Search Allowed
False
Selective Search Criteria
True
Prompt
Employee Name

Select LovMap1 and set following properties --

Attribute
Property
Lov Region Item
FullName_LOV
Return Item
Employee_Name
Criteria Item
Employee_Name

Create LovMap2 and set following properties for that --
Select Employee_Name > lovMappings right click New > lovMap
Set following properties for lovMap2 --

Attribute
Property
Lov Region Item
PersonId_LOV
Return Item
ParentPersonId

Build Second LOV on Page:

26. Right click the MainRN and click new messageLovInput
Set Following Properties for Newly Created messageLovInput

Attribute
Property
ID
Dependent_Name
External Lov
/prajkumar/oracle/apps/fnd/dependentlovdemo/webui/SecondLovRN
Search Allowed
True
Selective Search Criteria
True
Prompt
Dependent Name

Select LovMap3 and set following properties --

Attribute
Property
Lov Region Item
Second_FullName_LOV
Return Item
Dependent_Name
Programmatic Query
True

Create LovMap4 and set following properties for that --
Select Dependent_Name > lovMappings right click New > lovMap
Set following properties for lovMap4 --

Attribute
Property
Lov Region Item
Second_PersonId_LOV
Criteria Item
ParentPersonId
Required
True

27. Congratulation you have successfully finished. Run Your page and Test Your Work












How to find all cancel Requisitions

SELECT prha . *   FROM po_Requisition_headers_all prha , po_action_history pah   WHERE      1 = 1        AND pah . object_id ...