Anil's Blog is Best Viewed on GOOGLE CHROME

Friday, September 24, 2010

Popup in OAF - R12.1.2 Part II

If you have not gone through Popup first exercise then please go through to get brief intro about Popups.

Popup in OAF Part1

We can also UPDATE  through Popup region without navigation to update page.


The  region  popups when user click on update inline image.

We will be creating a new External Region EmpPopupRN for this popup. No need to give AM definition for this region. Add a submit button & beans in this region for which you want to update Set the VO attribute and VO name same as the VO of results table i.e. EmployeeSummaryVO.





Now in your Results table of Search Page Add a flowLayoutRN and under it create an item of style image and a region of style popup.



Now click on your popup region EmployeePopup and set its properties

Region             Path of above External Region EmpPopupRN
Title                 Update Employee
Height              190
Width               380





Now click on image Set the following properties.


PopupId                                  EmployeePopup
Popup Render Event             On Click
Popup enabled                        True

Now in our page as we will be having a save button so we need to handle this button and post the data when user clicks on it. So we will be writing our code in PFR of EmployeeResultsCO


if (pageContext.getParameter("Save") != null )
 {
 OAApplicationModule am = pageContext.getApplicationModule(webBean);
 am.invokeMethod("apply");
 }

//and this calls out Apply method in AM

public void apply()
{
 getTransaction().commit();

}

Now you can run your page and see that now you can update the fields without navigating to other page.

Compare VO row with Database row - OAF

Comparing VO row with DB Row to ensure that user has changed some VO Attribute value or not when user is submitting the page

Thanks
--Anil

Controller Extension in R12 - OAF

Controller/CO Extension - Jdev10G


Thanks Ajay for giving such a nice article 

Oracle does not recommend that customers extend controller objects associated with regions or webbeans in shipped E-Business Suite product pages. 

Controller class (oracle.apps.fnd.framework.webui.OAControllerImpl) methods should effectively be considered private, since their implementation is subject to change. Controller extensions are therefore not considered to be durable between upgrades. 

If it is absolutely essential to handle custom form submit events on a shipped product page, processFormRequest() is the only method that should be overriden in a controller class, although the risks outlined above still apply.


In this exercise I am going to extend CO of  ItemSearchPG of Lab solutions exercise shipped with Jdev Tutotrial.

The purpose of this exercise  is to modify the VO query of results table. I have changed the Item Number field Property "Selective Search" 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 Results name should not contain record for Item Number 3

If "About this Page" link is not available on page then set the Profile Option: FND :Diagnostics to "Yes" at User Level.
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.

So open Jdeveloper and create New OA Workspace and new Project under it as shown in below screen shots.

Click on File à New to open this window

Give the Workspace Name as OAExtenstions , check on Add a New Project and click Ok. 


This cause Project creation wizard to open. Name the project as OAExtensionsPrj and Default Package as xx.oracle.apps.fnd.framework.toolbox.labsolutions



Click on Next and move to Step 3 of 3 Give your DBC file name, User Name & Password for Apps , Responsibility Name and Application Short name. Then click next.



Now Right click on Your project and select New à General à Java Class click ok



Give the Name of your Extended Class give its  package path and in the extends property select base class.

Important : You need to copy the class file mentioned in Extends Property to MyClasses Folder if it is not there.

Name       :        XXItemSearchCO
Package   :        xx.oracle.apps.fnd.framework.toolbox.labsolutions.webui
Extends    :        oracle.apps.fnd.framework.toolbox.labsolutions.webui.ItemSearchCO



Write the logic in the extended controller file as needed
package xx.oracle.apps.fnd.framework.toolbox.labsolutions.webui;

import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.toolbox.labsolutions.server.ItemSummaryVOImpl;
import oracle.apps.fnd.framework.toolbox.labsolutions.webui.ItemSearchCO;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.apps.fnd.framework.webui.beans.layout.OAQueryBean;


public class XXItemSearchCO extends ItemSearchCO {
    public XXItemSearchCO() {
    }
   
    public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
     {
       super.processFormRequest(pageContext, webBean);
         OAApplicationModule am = pageContext.getApplicationModule(webBean);
         OAQueryBean queryBean = (OAQueryBean)webBean.findChildRecursive("QueryRN");

         //Capturing Go Button ID
         String go = queryBean.getGoButtonName();
       
         //If its Not NULL which mean user has pressed "Go" Button
         if(pageContext.getParameter(go)!=null)
         {
         // Setting whereClause at Runtime to restrict the query 
         ItemSummaryVOImpl vo = (ItemSummaryVOImpl)am.findViewObject("ItemSummaryVO1");
         vo.setWhereClause(null);
         vo.setWhereClause("Item_id <>:1");
         vo.setWhereClauseParam(0,3);
         }
     }
}


Now we need to attach this new controller with the page through personlisation. So click on Personalize page link on top right hand side of your page. If you are not able to see this link set Profile Option "Personalize Self-Service Defn"  to Yes.



Click on Complete View à Expand All and click on personalize icon next to pageLayoutRN



Now at site level give the path of extended controller as we are extending the controller at SITE LEVEL


Click on Apply Button and Return to Application.

Now you can check by click on Go Button that you are not getting Item id 3 rest are there.




That all ... :)







Wednesday, September 22, 2010

Popup Regions in R12.1.2 for JDev 10G - OAF

Ajay came up with a new Article on the Popup Functionality in R12.1.2 for Jdev 10G. Thanks Ajay.

Our objective is when a user hover its mouse over Employee Name field a popup window will open that shows details of that employee.


 Step 1
For this we will create an external region with AM definition as shown below name it as EmpSummaryPopupRN


 Step 2
 Now in our EmpSearch Page (Using the existing page) we will create a new flowLayout region and drag our EmpName messageStyledText field into it .


 Step 3
Now under this flowLayout region EmpNameLayout we will create a region of style popup and set Region property to above external region(EmpSummaryPopupRN, which we created in STEP1) name it as EmpSummaryPopup.


Now for the popup region to come up as soon as a user hover over EmpName field we need to set some Properties of this  field like 

 ID : EmpName
Popup ID :  EmpSummaryPopup
Popup Render Event : onHover
Popup Enable : True



After completing this Run your page and Hover over EmpName field you will see a new Popup window coming on to your page as shown in starting of this article.

Cheers!! 

Friday, September 17, 2010

Learn OAF

Getting started with OA Framework

Oracle Applications Framework (OA Framework) is the   Oracle Applications development and deployment platform for HTML-based business Applications.

OA Framework is based on the industry-standard J2EE MVC design pattern.

The MVC architecture is a component-based design pattern with clean interfaces between the Model, View, and Controller.

♣ The Model is where the application implements its business logic. All the BC4J components in OAF comes under Model like AM (Application Module), VO (View Object), EO (Entity Object), VL (View Link) & AO (Association Object).

♣ The View is where the application implements its user interface. View means the UI (User Interface) that is visible to the Users.

♣ The Controller is where the application handles user interaction and directs business flow. Controller is a simple javaclass file that contains methods for initial page request and post back request.

For more details please refer

The next step is to determine the correct JDev patch for your development system. We can find the correct version of Jdeveloper with two ways:

1) You can check the framework version in your instance by using http://host:port/OA_HTML/OAInfo.jsp,



2) Click “About this page” link on the bottom left of any OA Page and click on Technology Components.




If you are not able to see it please refer below link

After knowing the patch number you can download it from https://support.oracle.com
Note ID: ID 787209.1 - How to find the correct version of JDeveloper to use with eBusiness Suite 11i or Release 12.

♣  Once downloaded, follow the installation steps set out in the OAEXT_README.txt document , located in the root directory of your patch file.

♣  The JDeveloper patch includes a very comprehensive documentation library, after installation you can locate the documentation index here: DEV_INSTALL_DIR/jdevdoc/index.htm

♣  Follow the “You are Customer, Consultant or Support Representative” in Chapter 1: “Setting Up your Development Environment” of the OA Framework

I suggest you study Chapters 1, 2 and 3 of the OA Framework developers guide; this will present you with a detailed introduction to OA Framework development concepts. Chapter 8 of the developers guide covers OA Framework standards and guidelines.

The Oracle Applications Framework ToolBox Tutorial is a comprehensive step by step guide to OAF development, extension and personalization. The tutorial will guide you from creating your first “Hello World” program right through to multi-step update pages, partial page rendering techniques and advanced charts and graphs.



Where do I get help?

♣ Oracle Applications Framework Developer's Guide (Included in JDev Installation) 
The Developer's Guide fully documents the capabilities of the Framework including instructions, examples and essential standards for implementing business-tier objects, UI components and server-side features.

 Oracle Applications Framework ToolBox Tutorial Application (Included in JDev Installation)
The ToolBox Tutorial application is a sample application accompanied by extensive examples with step-by-step instructions that demonstrate the usage of business objects and UI components to build OA Framework based application pages, against a simple Purchase Order type application schema, installed on your 11i instance.

♣ OA Framework Discussion Forum on the Oracle Technology Network
Discussion forum for OA Framework Extensions and the OA Extension to Oracle9i JDeveloper, OA Framework Forum (http://forums.oracle.com/forums/forum.jspa?forumID=210). You can use the forum to post questions and exchange information with other users working with OA Framework technology.

 Oracle Applications Product Documentation
Some products may provide additional information on extending application specific business objects and functionality. Consult Oracle Metalink (http://metalink.oracle.com) under the respective product for more information.


Thanks
--Anil

Monday, September 6, 2010

Auto Suggest or Look Ahead LOV's OAF

This article has been contributed by Ajay Sharma well known name on OTN Forums. Thanks for his extended support

Recently Oracle in their R12.1.3 release has by default enabled Look Ahead LOV feature which was introduced in R12.1.2.

First a brief intro about Look Ahead LOV:-

When an end-user types in characters in the LOV search field, the results are fetched and displayed inline to the LOV component.

A user can select a value from this look ahead window just as in the classic LOV window. For most use cases, this capability eliminates the need to launch the LOV modal window, to perform a search within the window, and to navigate through the results using Next / Previous links in the LOV window results table, thereby saving a number of clicks and server-side requests, and significantly enhancing end-user productivity.

So to implement the same feature in R12.1.2 so you can follow below steps:

First create a simple LOV


Now for Look Ahead we need to set the following properties of MessageLovInput field

1) Under Functional heading,  set Look Ahead Enabled to True

2) Look Ahead Search to "Contains" or "Start With"
    Contains means all the records which contains the characters entered by user.
    Start with means all the records that start with characters entered by user.

3) Minimum Character for Search to Any Number as per your requirement.

    These are the minimum number of characters required to initiate the Look Ahead LOV eg 1,2,3 or more



Finally the LOV will look like this when user enters any character.



Important Profile Options for Look Ahead LOVs



FND: Disable Look Ahead LOV       :  Determine whether the Look Ahead LOV feature is enabled or disabled at the site or Application level.



Valid values are: FALSE - Look Ahead LOV feature is enabled.
                            TRUE - Look Ahead LOV feature is disabled

Default Value.: FALSE at Site level.





FND: Minimum Characters for Look Ahead: 


If the Look Ahead LOV feature is enabled,    
then this profile determines the minimum  
number of characters a user must enter to   
activate the Look Ahead LOV window.


Default Value : 3 at Site level

Hope it helps. Do let us know your views or comments

Thursday, September 2, 2010

OAF : Passing a Table Type Object to Oracle Stored Procedure & Retrieving Error Stack

Folks

Most of us have hard time in playing with Oracle's Table type object and Java's Array Descriptor.So i thought of posting it so that it could help us all.

For this Exercise i have taken two Standard Table Type objects named

JTF_NUMBER_TABLE       // Table type of Number Type     
JTF_VARCHAR2_TABLE_100  //Table type of Varchar2(100) Type

These two Objects are input to the Stored Procedure XX_PassTableType_prc in Package XX_PassTableType.

Table script that was used for this exercise is as follows

CREATE TABLE xx_test(
invoice_id VARCHAR(2000),
amount NUMBER);

Below is the code for Package.

CREATE OR REPLACE PACKAGE xx_passtabletype
AS
PROCEDURE xx_passtabletype_prc (
xx_number_table              jtf_number_table,
xx_varchar2_table   IN OUT   jtf_varchar2_table_100
);
END xx_passtabletype;

CREATE OR REPLACE PACKAGE BODY xx_passtabletype
AS
PROCEDURE xx_passtabletype_prc (
xx_number_table              jtf_number_table,
xx_varchar2_table   IN OUT   jtf_varchar2_table_100
)
AS
BEGIN
DBMS_OUTPUT.put_line ('I am here');

FOR i IN xx_varchar2_table.FIRST .. xx_varchar2_table.LAST
LOOP
INSERT INTO xx_test
(invoice_id, amount
)
VALUES (xx_varchar2_table (i), xx_number_table (i)
);

COMMIT;
END LOOP;

xx_varchar2_table :=
jtf_varchar2_table_100 ('Error while inserting record');
END xx_passtabletype_prc;
END xx_passtabletype;

Now coming to OAF Part.For this, we have create a Advanced table Region with two
columns & Submit Button. Now, on the click of button in processFormRequest() of Controller we are passing the Table View Object Data to the Stored Procedure with the help of Array Descriptor.

Controller Code:

public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processFormRequest(pageContext, webBean);

OAApplicationModule am = pageContext.getApplicationModule(webBean);

if (pageContext.getParameter("go") != null)
{
String[] as = null;
Number[] vNumber = null;

Connection conn = pageContext.getApplicationModule(webBean).getOADBTransaction().getJdbcConnection();
String mCreateSearchRequestStatement = null;
OAViewObject vo = (OAViewObject)am.findViewObject("MainVO1");
int j = vo.getFetchedRowCount();
try
{
System.out.println("abouce try");

vo.reset();
if (vo.getFetchedRowCount() > 0)
{
System.out.println(String.valueOf("Fetched row count ").concat(String.valueOf(vo.getFetchedRowCount())));
int i = 0;
as = new String[j];
vNumber = new Number[j];

while (vo.hasNext())
{
vo.next();

System.out.println(String.valueOf("Inisde the do while loop").concat(String.valueOf(i)));

vNumber[i] = ((Number)vo.getCurrentRow().getAttribute("ViewAttr1"));
as[i] = String.valueOf(vo.getCurrentRow().getAttribute("ViewAttr2")).concat(String.valueOf(""));
i++;
}
}

CallableStatement cs = conn.prepareCall("{call XX_PassTableType.XX_PassTableType_prc(:1, :2)}");
ARRAY array = new ARRAY(new ArrayDescriptor("APPS.JTF_NUMBER_TABLE", conn), conn, vNumber);
ARRAY array1 = new ARRAY(new ArrayDescriptor("APPS.JTF_VARCHAR2_TABLE_100", conn), conn, as);

cs.setArray(1, array);
cs.setArray(2, array1);
cs.registerOutParameter(2, 2003, "JTF_VARCHAR2_TABLE_100");

cs.execute();
ARRAY error = null;
error = (ARRAY)cs.getArray(2);

if ((error != null) && (error.length() > 0))
{
System.out.println(String.valueOf("Error is ").concat(String.valueOf(error.getArray())));

String[] retError = new String[j];
retError = (String[])error.getArray();

System.out.println(String.valueOf("Error in saving data").concat(String.valueOf(retError[0])));
}
cs.close();
}
catch (Exception exception)
{
throw new OAException(String.valueOf("Code Blast").concat(String.valueOf(exception)), 0);
}
}
}

Hope it helps!!!

Let me know if you finds any issues...

Cheers