Monday, June 20, 2016

Call D2K Form from OAF Page

This blog is about to call D2K form from OAF page. We will try to implement a OAF page to Call Order Management > Add Customers Form by clicking Go Button

1. Create a New OA Workspace and Empty OA Project
File> New > General> Workspace Configured for Oracle Applications
File Name -- CallformfromOAF
Project Name – Calld2kformfromOAF
Default Package -- call.oracle.apps.fnd.Calld2kformfromOAF

2. Set Run Options in OA Project Setting
Select Your Project in the Navigator and choose Project Properties
Select Oracle Applications > Run Options
Select OADeveloperMode and OADiagnostic, and move them to selected Options List

3. Create Application Module AM
Calld2kformfromOAF right click > New > ADF Business Components > Application Module
Name -- Calld2kformfromOAFAM
Package -- call.oracle.apps.fnd.Calld2kformfromOAF.server
Check Generate JavaFile(s)

4. Create a OA components Page
Calld2kformfromOAF right click > New > OA Components > Page
Name -- Calld2kformfromOAFPG
Package -- call.oracle.apps.fnd.Calld2kformfromOAF.webui

5. Modify the Page Layout (Top-level) Region

Attribute
Property
ID
PageLayoutRN
Region Style
pageLayout
Form Property
True
Auto Footer
True
Window Title
Call D2K from OAF Page Window Title
Title
Call D2K from OAF Page Header
AM Definition
call.oracle.apps.fnd.Calld2kformfromOAF.server. Calld2kformfromOAFAM

6. Create the Second Region (Main Content Region)
Select PageLayoutRN right click > New > Region

Attribute
Property
ID
MainRN
Region Style
messageComponentLayout

7. Create a container Region for Go-Button
Select MainRN right click > New > messageLayout

Attribute
Property
Region
ButtonLayout

8. Create a Second Item (Go Button)
Select ButtonLayout > New > Item

Attribute
Property
ID
Go
Item Style
submitButton
Attribute Set
/oracle/apps/fnd/attributesets/Buttons/Go

9. Add a Controller
Select MainRN right click > Set New Controller
Package Name -- call.oracle.apps.fnd.Calld2kformfromOAF.webui
Class Name -- Calld2kformfromOAFCO

10. Edit Your Controller
Add Following Code in processFormRequest
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{
 super.processFormRequest(pageContext, webBean);
 if (pageContext.getParameter("Go") != null)
 {
  //form:APPLICATION_SHORT_NAME:RESPONSIBILITY_KEY:DATA_GROUP_NAME
  //:FORM_FUNCTION_NAME
   
      String destination = 
         "form:ONT:ORDER_MGNT_SUPER_USER:STANDARD:ONT_OEXOEINL"; 
                             
  pageContext.forwardImmediatelyToForm(destination);             
 }
}

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

a
Enter userid and pwd


select your Responsibility


Requested D2K Form

END



Query to find Oracle Form Name and associated function

select
fnf.application_id,
fa.APPLICATION_NAME,
ff.FUNCTION_NAME ,
ffl.USER_FUNCTION_NAME ,
ffl.description ,
fnf.form_name,
ff.parameters,
ff.type
from fnd_form_functions_tl ffl,
fnd_form_functions ff,
fnd_form fnf,
fnd_application_tl fa
where
–ff.function_name like ‘******’
ffl.FUNCTION_ID=ff.FUNCTION_ID
–and ff.type=’FORM
and fnf.form_id=ff.form_id
and fa.application_id=fnf.application_id
–and fa.APPLICATION_ID=******

Friday, June 17, 2016

Error You are trying to access a page that is no longer active. - The referring page may have come from a previous session. Please select Home to proceed.

The root cause of this error are the profile options:
1) FND_VALIDATION_LEVEL - None
2) FND_FUNCTION_VALIDATION_LEVEL - None
3)Framework Validation Level- None
They should be none in order to avoid the error.The root cause of the error is MAC key url validation, which is governed by the above 3 profiles.

Also, if you are getting error in doing a page submit on pop up page confirm:
FND: Framework Compatibility Mode profile option should have value greater than or equal to "11.5.10".

Implement Train in OAF Page



Let us try to implement train between three pages. Consider three pages each having Text Item

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 -- train.oracle.apps.fnd.traindemo

2. Create Application Module AM
TrainDemoProj right click > New > ADF Business Components > Application Module
Name -- TrainDemoAM
Package -- train.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 -- train.oracle.apps.fnd.traindemo.webui

4. Modify the Page Layout (Top-level) Region

Attribute
Property
ID
PageLayoutRN
Region Style
pageLayout
Form Property
True
Auto Footer
True
Window Title
Train Demo Window Title
Title
Train Demo Page Header
AM Definition
train.oracle.apps.fnd.traindemo.server.TrainDemoAM

5. Create the Second Region (Main Content Region)
Select PageLayoutRN right click > New > Region
Attribute
Property
ID
MainRN
Region Style
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
Style – train
Select TrainRN inStructure pane and open property inspector and set Allow Interaction property to True

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=/train/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=/train/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=/train/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 structure panel, and select New > location from page Context menu
Set following properties as follow --
ID – TrainDemoRN
Extends -- /train/oracle/apps/fnd/traindemo/webui/TrainRN

10. Create a Standalone (Shared) TrainFooterRN
TrainDemoProj > New > Web Tier > OA Components > Region
Name -- TrainFooterRN
Package -- train.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 Item’s properties as follows:
ID – Step1Link
Item Style – link
Text – Step 1 of 3: Page1
Warn About Changes – False
Destination URI -- /train/oracle/apps/fnd/traindemo/webui/TrainDemoPG1

Right Click on NavBar > New > link
Set Item’s properties as follows:
ID – Step2Link
Item Style – link
Text – Step 2 of 3: Page2
Warn About Changes – False
Destination URI -- /train/oracle/apps/fnd/traindemo/webui/TrainDemoPG2

Right Click on NavBar > New > link
Set Item’s properties as follows:
ID – Step3Link
Item Style – link
Text – Step 3 of 3: Page3
Warn About Changes – False
Destination URI -- /train/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 – train.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);

 int step = trainBean.getSelectedTrainStepRenderedIndex();
 OANavigationBarBean navBean =
  (OANavigationBarBean)webBean.findChildRecursive("NavBar");
 navBean.setValue(step+1);
} // end processRequest()

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 region’s properties as follow:
ID -- PageButtonBar
Style -- pageButtonBar
Extends -- /train/oracle/apps/fnd/traindemo/webui/TrainFooterRN
15. Congratulation you have successfully finished. Run Your TrainDemoPG1 page and Test Your Work

a

b

end
Package – train.oracle.apps.fnd.traindemo.webui

Wednesday, June 15, 2016

Creating and Updating on one click in OA Framework

We will try to implement Search Page with one text item as ID. Based on ID control will go to second page. Second page contain three text rows. ID will be displayed on second page as Styled Text in all three rows
If match will be found based on ID then search result will come. If not found then empty rows will come. Based on that new data can be inserted there and existing data can be updated directly with one button click ‘Apply’ 

1. Create a New Workspace and Project
Right click Workspaces and click create new OAworkspace.
File Name – PrajkumarSearch
Project Name -- SearchDemo
package -- search.oracle.apps.PO.searchdemo

2. Create a New Application Module (AM)
Right Click on SearchDemo > New > ADF Business Components > Application Module
Name -- SearchAM
Package -- search.oracle.apps.PO.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. Using Emp Table
Select * From Emp;

5. Create a New Entity Object (EO)
Right click on SearchDemo > New > ADF Business Components > Entity Object
Name – SearchEO
Package -- search.oracle.apps.PO.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 -- search.oracle.apps.PO.searchdemo.server
In Step2 in Entity Page select SearchEO and shuttle them to selected list
In Step3 in Attributes Window select columns empno, ename, job,mgr,hiredate,sal,comm,deptno 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 -- search.oracle.apps.PO.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 -- search.oracle.apps.PO.searchdemo.server.SearchAM
Window Title –Page Window
Title – Page Header
Auto Footer – True

11. Create the Second Region (Main Content Region)
ID – MainRN
Region Style -- messageComponentLayout
Auto Footer – True

12. Create the first Item (Empty Field)
MainRN > New > messageTextInput
Set Following properties for new item
ID – MyId
Style Property – messageTextInput
Prompt – Id
Data Type – Number
Length – 20
Maximum Length – 100

13. Create a container Region for Go-Button
MainRN > messageLayout
Set ID -- ButtonLayout

14. Create a Item (Go Button)
Select ButtonLayout > New > Item
ID – Go
Item Style – submitButton
Attribute -- /oracle/apps/fnd/attributesets/Buttons/Go

15. Create a New Second Page
Right click on SearchDemo > New > Web Tier > OA Components > Page
Name -- CreateUpdPG
Package -- search.oracle.apps.PO.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 -- search.oracle.apps.PO.searchdemo.server.SearchAM
Window Title –Page Window
Title – Page Header
Auto Footer – True

18. Create the Second Region (Main Content Region)
ID – MainRN
Region Style -- table
Auto Footer – True
Records Displayed – 3

19. Create the first Item (Empty Field)
MainRN > New > item
Set Following properties for new item
ID – empno
Style Property – messageTextInput
Prompt – empno
Data Type – number
Length – 20
Maximum Length – 4
View Instance -- SearchVO1
View Attribute -- empno

Create Second Item
MainRN > New > item
Set Following properties for new item
ID – ename
Style Property – messageTextInput
Prompt – ename
Data Type – VARCHAR2
Length – 20
Maximum Length – 10
View Instance -- SearchVO1
View Attribute -- ename

Create Third Item
MainRN > New > item
Set Following properties for new item
ID – job
Style Property – messageTextInput
Prompt – job
Data Type – VARCHAR2
Length – 20
Maximum Length – 9
View Instance -- SearchVO1
View Attribute -- job

Create Fourth Item
MainRN > New > item
Set Following properties for new item
ID – mgr
Style Property – messageTextInput
Prompt – mgr
Data Type – NUMBER
Length – 20
Maximum Length – 4
View Instance -- SearchVO1
View Attribute -- mgr


Create Fifth Item
MainRN > New > item
Set Following properties for new item
ID – hiredate
Style Property – messageTextInput
Prompt – mgr
Data Type – date
Length – 20

View Instance -- SearchVO1
View Attribute -- hiredate


Create Sixth Item
MainRN > New > item
Set Following properties for new item
ID – sal
Style Property – messageTextInput
Prompt – sal
Data Type – number
Length – 20
Maximum Length – 7
View Instance -- SearchVO1
View Attribute -- sal

Create Seventh Item
MainRN > New > item
Set Following properties for new item
ID – comm
Style Property – messageTextInput
Prompt – comm
Data Type – NUMBER
Length – 20
Maximum Length – 7
View Instance -- SearchVO1
View Attribute -- comm

Create Eith Item
MainRN > New > item
Set Following properties for new item
ID – Deptno
Style Property – messagestyledText
Prompt – deptno
Data Type – NUMBER
Length – 20
Maximum Length – 2
View Instance -- SearchVO1
View Attribute -- deptno


20. Add Controller for Page SearchPG Select PageLayoutRN right click Set New Controller
Package Name -- prajkumar.oracle.apps.fnd.searchdemo.webui
Class Name -- SearchCO
Add Following code in that controller

  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=/search/oracle/apps/PO/searchdemoPRJ/webui/CreateUpdPG",
            null,                             
            OAWebBeanConstants.KEEP_MENU_CONTEXT,                                                    
            null,                                                    
            hmap,                             
            true, 
            OAWebBeanConstants.ADD_BREAD_CRUMB_NO,
            OAWebBeanConstants.IGNORE_MESSAGES);  
    }
    
    
  }

}

21. Add Return Link to come back to SearchPG from CreateUpdPG
Select CreateUpdPG in Structure Panel Select PageLayoutRN > New > returnNavigation
ID – ReturnLink
Destination URI – OA.jsp?page=/search/oracle/apps/PO/searchdemo/webui/SearchPG&retainAM=Y
Text – Return to SearchPG
 
22. Add pageButtonBar region to implement Apply Button
Right click on PageLayout > New > Region
Set following properties for new region
ID -- ButtonBar
Region Style – pageButtonBar
Select ButtonBar right click > New > Item
Select newly created item and set following properties –
ID – Apply
Item Style – submitButton
Attribute Set -- /oracle/apps/fnd/attributesets/Buttons/Apply
 
23. Add Controller for Page CreateUpdPG Select PageLayoutRN right click Set New Controller
Package Name -- search.oracle.apps.PO.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);
    
  }

  /**
   * Procedure to handle form submissions for form elements in
   * a region.
   * @param pageContext the current OA page context
   * @param webBean the web bean corresponding to the region
   */
  public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    super.processFormRequest(pageContext, webBean);
    OAApplicationModule am=pageContext.getApplicationModule(webBean);
    
    if(pageContext.getParameter("Apply")!=null)
    {
      am.getOADBTransaction().commit();
      
      pageContext.setForwardURL(
                "OA.jsp?page=/search/oracle/apps/PO/searchdemoPRJ/webui/searchPG",
                null,         
                OAWebBeanConstants.KEEP_MENU_CONTEXT,         
                null,         
                null,         
                true,         
                OAWebBeanConstants.ADD_BREAD_CRUMB_NO,         
                OAWebBeanConstants.IGNORE_MESSAGES);    
    }
  }

}
24. Add Following code in SearchAMImpl.java

import oracle.apps.fnd.framework.server.OAApplicationModuleImpl;
import oracle.jbo.Row;

  public void createRow(String Val)
  {
    EmpVOImpl vo=getEmpVO1();
    vo.initQuery(Val);
    
    int rowCount=vo.getRowCount();
    if(rowCount<7)
    {
      for(int i=7;i!=rowCount;rowCount++)
      {
        Row studrow = vo.createRow(); 
                  vo.last();
                  vo.next();
                        
                  vo.insertRow(studrow);
                  vo.setCurrentRow(studrow);
                  vo.getCurrentRow().setAttribute("Deptno",Val);
                  studrow.setNewRowState(Row.STATUS_INITIALIZED);
      }
    }

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()))))
  {
    Number Val2=null;
    
    try
    {
      Val2=new Number(Val);
          }
          catch(Exception e)
          {
            throw new OAException("AK", "FWK_TBX_INVALID_EMP_NUMBER");
          }
          setWhereClause("Deptno=:1");
    setWhereClauseParams(null); 
         setWhereClauseParam(0, Val2);
         executeQuery();
  }
  }

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

a
b
c
Back to Search Page from CreateUPtPG