Oracle Application Framework (OAF) View Object Extension

Share Button

Hello,

During extension developments for OAF pages, sometimes we need extra fields which are not available in standard view object. In this kind of situations, we are creating a new view object and make it extend standard view object. Please follow carefully all the steps in this tutorial in order to avoid JDeveloper bug messages.

First of all, change the following profile values to “Yes”.

  • Personalize Self-Service Defn (FND_CUSTOM_OA_DEFINTION)
  • FND: Diagnostics (FND_DIAGNOSTICS)

vo_1

Open the page which you will extend view object. For this tutorial, I used a view object which is placed in Vendor Summary Query page in Account Payables. I am going to add ADDRESS_LINE1 column which is actually a site information and do not included in standard view object. Since a supplier may have more than one address, I am going to use rownum=1 in where condition.

Page MDS Path: /oracle/apps/pos/supplier/webui/SuppSummPG

vo_2

Click to “About This Page” link and open page XML hierarchy and expand pageLayout region.

vo_3

Scan the page from up to down and find the SuppSummVO view object that attached to the supplier table in the page. If view object name is not clickable, go down to the page and open expand “Business Component References Details” link. Click to the view object link. You will be forward to the page where sql query and correspending java attributes reside. Check that ADDRESS_LINE1 column is not in the query and attribute list.

vo_5

The standard view object is placed in POS module. During extension development, in order to handle dependencies and compilation errors in JDeveloper, download pos folder from $JAVA_TOP/oracle/apps in EBS application server to <JDEV_USER_HOME>/myprojects/oracle/apps via FTP.

vo_6

At this point, JDeveloper should display the downloaded pos module with inside packages in project navigator. In order to create custom view object, right click to the project and select “New”. Select Business Tier -> ADF Business Components -> View Object and click OK button.

vo_8Create view object wizard should be opended. Click to Next button in initial step.
vo_9

At first step we need to define a proper name and package for new view object.

Package Name
xxntc.oracle.apps.pos.supplier.server  xxSuppSummVO

Click to the Browse button and find the SuppSummVO view object and select it. With this action, custom view object can extend standard view object query and attributes.

vo_10

When Browse button is clicked and if view object list is empty then close the wizard. Expand the packages in project and open Create View Object wizard again.

Without changing anything, go up to the step 7.

vo_12 vo_13 vo_14 vo_15 vo_16

If you do not aim to change getter and setter or change sql query where clause in runtime, uncheck Generate Java File ticks.

vo_17

Click to the Next and click to Finish.

vo_18

Double click to the custom view object and open the wizard.

vo_19

Before moving to the next part, we need to write a simple PL/SQl function which will return address_line1 for us. I prefer writing pl/sql function instead of directly adding to the sql query because it will be much easier to modify in future. In addition, It makes a certain difference with standard columns and custom columns in sql query.

Go to the “Attributes” section in view object wizard and click to “New” button.

vo_20

Add an attribute with following information:

Name Type Updatable Mapped to Column or SQL Alias Type Expression
XxAddressLine1 String Never Checked xx_address_line1 VARCHAR2(240)  apps.xx_vo_extension(pv.vendor_id)

Later, We will use “Name” attribute in personalization. “Alias” attribute is also very important when modifying standard sql query.

vo_21

Modify the sql query. Add column with same alias. Pay attention to line 32 and 87.

vo_22

Click to Apply and OK buttons and close wizard and save JDeveloper. Copy POS folder from myprojects to myclasses in operating system. Right click to the project and click “Make”.  You may get some warnings, just ignore them. The important thing is compiling without any error.

vo_23

If project may be compiled without any problem, right click to the project and open properties. From left menu expand “Business Components” and select “Substitutions”. In the right side of wizard, there must be two window: Available and Subsitute. Select “SuppSummVO” from Available window and select “xxSuppSummVO” from Subsitute window. Click to the Add buton. Click to OK button and close the wizard. One again make and compile the project.

vo_24

If no problem occurs until this point, you will be able to see <Subsitutes> tag in <YourProject>.jpx file.

We need to import jpx file into EBS metadata services and upload custom view object to the JAVA_TOP/xx/.. path in application server.

In order to import substitutions (jpx file) into database, use the following script. Change it according to your computer and database instance.

vo_25

After uploading vo files is done, bounce the oc4j and apache servers. Login to EBS and open the same page. Click to the “About This Page” link. Expand “Business Component References Details” and you must see your custom view object in the list.

vo_26

Click to your custom view object and you must see xx_address_line1 in both sql query and attributes section. This means that you can use this attribute during personalization.

vo_27

You can check your subsitution with following pl/sql script:

Result: /oracle/apps/pos/supplier/server/customizations/site/0/SuppSummVO

To Print Document:

Result:

Open the page and click to “Personalize Suppliers Table”.

vo_28Click to “Create Item” in order to create a new item in the table.
vo_29Choose level as “Site” and Item Style “Message Style Text”.

Do the following changes:

ID Prompt View Attribute View Instance
xx_address_line1  xx_address_line1  XxAddressLine1  xxSuppSummVO

vo_30Result:
vo_31