In day to day OAF requirements, you might across a situation wherein you need to show a page loaded with data based on some condition. It does not make sense to redirect to the second page and then a provide a return link to the first page. In such cases popup window is the ideal solution. Below are the step by step details on launching a javascript popup window from an OAF screen.
Requirement: To open popup window from an OAF screen
Step 1: Create a new OA workspace and OA project
Create a OA workspace with file name as: Popup
Create a OA project with file name as: Popup
Default package: oaf.oracle.apps.fnd.Popup
Once your project is created, double click on Popup 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 Popup project -> click New -> select ADF Business components -> select Application Module
Package: oaf.oracle.apps.fnd.popup.server
AM Name: PopupAM
Check Application Module Class: PopupAMImpl Generate Java File(s)
Step 3: Create a OA Components page
Right click on Popup project -> click New -> select OA components under Web Tier -> select Page
Package: oaf.oracle.apps.fnd.popup.webui
Page Name: PopupParentPG
Step 4: Set Page properties
Select on the PopupParentPG 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.popup.webui
Controller name: PopupParentCO
This automatically sets the controller class property in PopupParentPG page properties
We have created CO to capture a button event which launches the popup window
Step 6: Create a button
Select PageLayoutRN in the structure pane -> Right click on it -> New -> Item
Item ID -> button
Item Style -> submitButton
Prompt -> Open Popup
Step 7: Create popup screen
Right click on Popup project -> click New -> select OA components under Web Tier -> select Page
Package: oaf.oracle.apps.fnd.popup.webui
Page Name: PopupPG
Step 8: Set Page properties
Select on the PopupPG 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 9: Set new Controller
Select PageLayoutRN in the structure pane -> Right click on it -> Set new controller
Package: oaf.oracle.apps.fnd.popup.webui
Controller name: PopupCO
Step 10: Create a text element
Select PageLayoutRN in the structure pane -> Right click on it -> New -> Item
Item ID -> text
Item Style -> staticStyledText
Step 11: Capture button click event in PopupParentCO
Add the code in the following Process Form Request Function in your PopupParentCO as below
if(pageContext.getParameter("button")!=null){
String url ="/oaf/oracle/apps/fnd/popup/webui/PopupPG";
//retain am parameter
String amMode ="true";
//additional parameters to be passed to pop up page
String param1 = "Hello ";
String param2 = "World!";
String params="param1="+param1+"¶m2="+param2;
//Computing page_url
String page = url + "&retainAM=" + amMode + "&fndOAJSPinEmbeddedMode=y" + "&" + params;
//Computing final url
String destURL = OAWebBeanConstants.APPS_HTML_DIRECTORY + OAWebBeanConstants.APPLICATION_JSP + "?" + OAWebBeanConstants.JRAD_PAGE_URL_CONSTANT + "=" + page;
String javascript = "var a = window.open('"+destURL+"', 'a','height=400,width=400,status=yes,toolbar=no,menubar=no,location=no'); a.focus();";
pageContext.putJavaScriptFunction("javascript",javascript);
}
Step 12: Get parameters in PopupCO
Add the code in the following Process Request Function in your PopupCO as below
String param1 = pageContext.getParameter("param1"); //get passed parameters
String param2 = pageContext.getParameter("param2");
OAStaticStyledTextBean text = (OAStaticStyledTextBean)webBean.findChildRecursive("text");
text.setText(pageContext,param1+param2);
Result:
On page load:
On button click a window pops up.
Comments
The initial page is working fine for me. If i click on the button, I am getting an error ''You have insufficient privileges for the current operation. Please contact your System Administrator." . Please help me what would be the issue.
Set the below profile.
1) FND_VALIDATION_ LEVEL - None
2) FND_FUNCTION_VA LIDATION_LEVEL - None
I am opening a pop up page on a button click using javascript. Passing VO attributes in the URL. but when am fetching in the CO of the pop up page i get null values.
javascript:var a =window.open('/ OA_HTML/OA.jsp? page=/bvppa/ora cle/apps/pa/pro mis/forecast/we bui/BVPActualsP G&ProdOffcNum={ @ProductionOffi ceNumber}&ProjI d={@ProjectId}& FirmBudgetId={@ FirmBudgetId}&F irm=Yes&BudgetI d={@BudgetId}&r etainAM=Y&fndOA JSPinEmbeddedMo de=y¶m1=Hel lo ¶m2=World!' , 'a','height=400 ,width=800,stat us=yes,toolbar= no,menubar=no,l ocation=no'); a.focus();
am able to fetch calue for only one attribute - FirmBudgetId.
for the rest of the attributes am getting null values. i have set the values in the CO of the base page.
RSS feed for comments to this post