Tuesday May 15, 2012

Adding OAF Bean Through Personalization

In this blog I will explain different methods of adding a OAF bean to a page.I will use standard R12 Supplier page for demonstration (/oracle/apps/pos/supplier/webui/QuickUpdatePG).

There are two methods to add a web bean to an existing page.

1) Through controller.
2) Through personalization.

I will explain with a business scenario.My customer wants to add a MessageChoice bean to Supplier page.The bean should show supplier type External or Internal.

Following components should be in place before doing this requirement.

a) Custom table which holds the Supplier Type values.

CREATE TABLE xxcust_sup_type ( type_id NUMBER,type_code VARCHAR2(100),type_desc VARCHAR2(100));
INSERT INTO xxcust_sup_type VALUES(1,'EXT','External');
INSERT INTO xxcust_sup_type VALUES(2,'INT','Internal');

 2) ViewObject for MessageChoice bean.

Adding through controller

Here I will create the Message Choice bean programmatically through controller.After that i will assign it to standard page through personalization.


1) First step we have to do here is to identify the place in the page to add the bean.You can either download the page from $POS_TOP/mds/supplier/webui or get the page definition through jdr_utils.printDocument.I will follow the second approach.

The region is identified as OrgDetailsRN.

2) Identify the VO attribute to which the new bean to attach.Here i am using attribute1 of ap_suppliers table.Go to About The Page and click on business components and check the SupplierVO.

So Attribute1 is present in the VO.So we can directly use this.If in case the attribute is not part of VO we need to create a custom VO with attribute and substitute the new VO with existing VO.

3) Find the controller of QuickUpdatePG from About The Page.

The controller is identified as oracle.apps.pos.supplier.webui.QuickUpdateCO.

4) Create a new controller which extends the above identified controller.In the new controller's process request write the logic to create the new web bean.


Note: Please make sure super.processRequest(pageContext, webBean) is the first line of execution.

5) Copy to new location in $JAVA_TOP and generate class file.

6) Click on Personalize Page of QuickUpdatePG.

7) Click on Personalize of pageLayoutRN.

8) Set the controller in Site level as xxcust.oracle.apps.pos.supplier.webui.XXCUSTQuickUpdateCO.Click on Apply and come to the main page by clicking Return to Application.

9) Now you can see the newly created MessageChoice.

10) Try to create or update a supplier with Supplier Type as Internal.Save the transaction.Check ap_suppliers table attribute1.

Note: When you are creating web bean programmatically it is not possible to personalize that item. You can see the below screen shot of QuickUpdatePG after the creation of Supplier Type.

Supplier Type is not available for personalization.

Adding through personalization

Here i will create the web bean through personalization.

1) Create the custom controller which extends the standard QuickUpdateCO.In the controller only instantiate the MessageChoice VO.


2) Click on Personalize Page.In the Personalize page click on Complete View.

3) Under Message Component Layout:OrgDetailsRN click on Create Item.

4) Give the properties mentioned as below.



Item Style

Message Choice

Picklist Display Attribute


Picklist Value Attribute


Picklist View Definition



Supplier Type

View Attribute


View Instance


5) Click on Apply.After that click on Return to Application.

6) In the Supplier page you can see the newly created Message Choice.

7) Create or update any supplier with Supplier Type as External and save the transaction.Query ap_supplier.attribute1.You can see the Supplier Type value there.


a) Here we have created the item through personalization.So the Message Choice is available for further personalization.

b) In the custom controller give appropriate debug message for easy debugging.To see the debug message go to Diagnostics in the Home page.Choose Diagnostics as Show Log on Screen and Log Level as Procedure.After that come to supplier page and you can see our custom debug message in the bottom of the screen.