Sie sind auf Seite 1von 4

Adding Columns to Advanced table in OA Framework Programmatically

By Extension
A commonly encountered restriction with OA Framework Personalization is that you cannot add
certain type of beans using personalization. For example, lets say you wish to add a Submit button to a
page. Another scenario is whereby you wish to add a Column Group or Column to an advanced table
layout. These are two of the most common scenarios that cannot be achieved using personalization
Note:- In R12 though, new columns can be added to Advanced Table bean using Personalization- however
this is not possible in 11i, hence the need of this article.
In this article, I will also explain one of the common issues that you face during controller
extension, due to the inherent nature of how controller extensions get registered in MDS. Such restrictions
can be overcome quite easily by programmatically instantiating such items [or call them beans],
followed by programmatically attaching these newly created items/beans to the page.

Given the declarative nature of OA Framework, you can create most type of objects programmatically, be
it AM or VO or an entire Advanced Table.
In this article, I will show you how, using OA Framework Extensions, you can add a New Column within an
existing advanced table region. [Note:- This is not possible via personalization, either in 11i or in
R12[checked until Rollup3]

NOTE:- In Release 11i, it is indeed possible to add a column to a table based bean on OA Framework
page using personalization[ but not to advanced table]

Key challenges faced in such requirement
You cannot add a new column [or column group] to an Advanced Table section of the page using
personalization.
The requirement is:-
To add a column to advanced table, which will appear as field. This column will be attached to a View
Object attribute.

Achieving in R12 environment:
Personalize the Advanced table to add a column.
Personalize the newly added column to Advanced Table, so that a field is added to this column
while creating this field via personalization, you will map that field to view object attribute.

In 11i Environment:-
Create new controller class, that extends the existing controller against the page
In extended controller, in processRequest, do below steps programmatically
a. Call super.processRequest to process standard functionality
b. Get a handle to the existing advanced table bean on that page
c. Create a column by using createWebBean
d. Create a field (lets say messageStyledText)
e. Map this new field to ViewObject Attribute
f. Attach this field to the column
g. Attach this column to existing Advanced Table

What if there isnt a standard view object attribute available?
In this case, you will be required to extend the View Object.
By extension, you will be adding a new attribute/column to the extended view object.

How will the new VO Attribute be mapped to Column/item within advanced table?
This will happen programmatically, you will find in the sample code.

But how do I get started for this solution?
1. Find out the name of the page on which Advanced table resides. This can be done by attempting to
personalize the page. When you personalize, the entire path of the page will be listed, in the format
/oracle/apps/ota/admin//webui/otabcdPG
[Note:- You might as well use about this page to find this out]
2. Open this page in jDeveloper and identify the controller class that you will need to extend. [Note:-
Again, you might as well use about this page to find this out]. Also if you fancy, you can use vi editor to
read the XML page definition from $MODULE_TOP/mds//pagenamePG.xml
3. Try to make that page run from jDeveloper itself. Once you can produce a test case on jDeveloper, then
rest of development becomes a cakewalk.
4. Optionally, instead of extending the controller class, to begin with temporarily, simply modify the base
Controller classs java file from jDeveloper. Append your logic to processRequest. Once you are
completely satisfied with results, you can then move changes from base class into a new extended
controller class.
5. Use personalization to substitute the standard controller class by custom controller class.
****What is the reason for this additional step ****
Problem definition:- The moment you specify an extended controller using personalization, that extended
controller reference will get stored in the database. This will happen even though you have done your
extension while running page off your local PC[jDevelopers oc4j]

Following situation can arise:-
1. You create an extended controller in jDeveloper
2. You run the page via jDeveloper
3. You personalize the page by running it via jdeveloper, to specify new controller class
4. This new controller class reference gets stored in MDS Tables of database
5. Some other person runs the same page via Linux/Unix server, by accessing application URL. This will
make OAF search for extended class in $JAVA_TOP. This will error given that extended controller is
yet to be deployed to server.

Hence, we have two options
1. Do your testing by appending code to std decompiled class on jdeveloper
2. Deploy a stub class for extended controller as soon as you have done your personalization.
Lets take this scenario, where you wish to add a new column to an existing AdvancedTable bean
Assumption :- Name of advanced table bean is AccountsLinesAdvTable
Name of view object is PoRequisitionLinesVO
Name of the view object attribute being displayed is QcfocustChargeAccountDescr
Note:- In this example, VO Attribute begins with Qc, as it is an extended VO Attribute


//====SAMPLE SOURCE CODE FOR THIS EXTENSION IS AS BELOW====
package Qcfocust.oracle.apps.icx.por.req.webui;

import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageStyledTextBean;
import oracle.apps.fnd.framework.webui.beans.table.OAAdvancedTableBean;
import oracle.apps.fnd.framework.webui.beans.table.OAColumnBean;
import oracle.apps.icx.por.req.webui.CheckoutLinesCO;

public class QcCheckoutLinesCO extends CheckoutLinesCO
{
public QcCheckoutLinesCO()
{
}

public void QcfocustProcessRequest(OAPageContext oapagecontext, OAWebBean oawebbean)
{
System.out.println("Inside CheckoutLinesCO, executing QcfocustProcessRequest()" ) ;
OAAdvancedTableBean tableBean =
(OAAdvancedTableBean)oawebbean.findIndexedChildRecursive("AccountsLinesAdvTable") ;
OAColumnBean columnForSegment1 =
(OAColumnBean)tableBean.findIndexedChildRecursive("ChargeAccountCol");
OAMessageStyledTextBean
leaf2=(OAMessageStyledTextBean)createWebBean(oapagecontext,MESSAGE_STYLED_TEXT_BEAN,null,"Le
af2");
leaf2.setViewUsageName("PoRequisitionLinesVO");
leaf2.setViewAttributeName("QcfocustChargeAccountDescr");
columnForSegment1.addIndexedChild(leaf2);
}

public void processRequest(OAPageContext oapagecontext, OAWebBean oawebbean)
{
super.processRequest(oapagecontext, oawebbean);
QcfocustProcessRequest(oapagecontext, oawebbean);
}
}

Das könnte Ihnen auch gefallen