Anil's Blog is Best Viewed on GOOGLE CHROME

Saturday, November 13, 2010

EO based VO Extension in OAF – R12

Thanks Ajay for sharing this wonderful article on View Object extension

In the article we are going to extend QueryVO of EmployeeSearch page.

Our business requirement is to add employee Title and MiddleName column in the results table region


Analyzing the Page

click on “About this Page” link to check that which ViewObject is associated with the table region [ResultsRN]


Here we can see that results table has QueryVO attached to it. Now click on Business Component Reference details and check the path of QueryVO


So now click on QueryVO which is an EO based [FwkTbxEmployeesEO] to check whether it has those attribute or not those we want to add


Here we can see that our VO does not have Title & MiddleName attribute.

So for adding these attribute we need to perform VO Extension.

Now FTP the complete solution package (i.e. oracle.apps.ak.solution) from Application server into myclasses\oracle\apps\ak folder as well as in myprojects\oracle\apps\ak folder.


Open Jdeveloper and create a new OA workspace and project. Name workspace as Extend.jws and project as Extend.jpr.

Now right click on Extend project to open project properties Project ContentAdd to include the standard VO package in current project.




After adding BC4J package i.e. oracle.apps.ak.solution project looks like




Creating New View Object (VO): -

Right click on your project and select New-->Adf business Components-->View Object



Give the package name as oracle.apps.ak.ajay.employee.server, VO name as ExtQueryVO and in the extends property select QueryVO



The next screen allows the addition or deletion of Entity Objects. No change is required here for this extension so simply select Next.

The next pane allows additional attributes to be added or attributes to be removed. In this case add both the MIDDLE_NAMES and TITLE attributes to the selected list

Please note the new attribute you would be adding will be coming as Transient





Click on Next --> Next

Modify your sql statement to add new created attributes
SELECT FwkTbxEmployeesEO.EMPLOYEE_ID, 
       FwkTbxEmployeesEO.FULL_NAME AS EMPLOYEE_NAME, 
       FwkTbxEmployeesEO.EMAIL_ADDRESS AS EMPLOYEE_EMAIL, 
       FwkTbxEmployeesEO1.EMPLOYEE_ID AS MANAGER_ID, 
       FwkTbxEmployeesEO1.FULL_NAME AS MANAGER_NAME, 
       FwkTbxEmployeesEO1.EMAIL_ADDRESS AS MANAGER_EMAIL,
       FwkLookupCode.MEANING AS POSITION_DISPLAY,
FwkTbxEmployeesEO.Middle_Names,FwkTbxEmployeesEO.Title
FROM   FWK_TBX_EMPLOYEES FwkTbxEmployeesEO,
       FWK_TBX_EMPLOYEES FwkTbxEmployeesEO1,
       FWK_TBX_LOOKUP_CODES_VL FwkLookupCode
WHERE  FwkTbxEmployeesEO.MANAGER_ID = FwkTbxEmployeesEO1.EMPLOYEE_ID (+)
       AND FwkTbxEmployeesEO.POSITION_CODE = FwkLookupCode.LOOKUP_CODE
       AND FwkLookupCode.LOOKUP_TYPE = 'FWK_TBX_POSITIONS'
Click on nextNext

Generate RowImpl and click on finish


Now as our attributes were created as Transient hence to fix this issue we have two options:

1. We need to correct our XML file generated as it is a known error with Jdeveloper 10G & earlier versions.
2. Double click on that attribute i.e MiddleName & Title and in the View Object Attribute window, enter attribute name  in 'Expression' column i.e. Title.

Open your ExtQueryVO.xml file in some notepad editor.
Scroll to bottom of that file
Update





With






Save the xml file.
And restart your jdeveloper and check that in attributes its not showing as transient.





Substitute Your New VO for the Parent VO

Now we need to perform the VO substitution For this we will right click on Extend project and open project properties-->Business Components-->Substitutions.

Select the QueryVO in Available and ExtQueryVO in Substitute list and click on Add button and then press Ok button.


FTP VO.xml, .class, .jpx files to $JAVA_TOP appropriate folder and Run jpximporter
java oracle.jrad.tools.xml.importer.JPXImporter $JAVA_TOP/Extend.jpx -username apps -password apps -dbconnection "(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=***)(PORT=****))(CONNECT_DATA=(SID=***)))"


Personalize the page to create new items:-

On QueryPG and click on personalize page  complete view and click on Create Item on Table: Employee Table


Set the item style as messageStyledText. Give the id, prompt , View Instance and View Attribute.



Click on Apply -> return to application. You can notice that the page has new two columns.



That's All :)

6 comments:

  1. Hi Anil,

    I did the vo extension successfully. But i want to know how to handle the extended vo in controller.
    Can you please tell me how to do it?

    Thanks in advance,
    SAN

    ReplyDelete
  2. Hi Anil,

    Thanks for sharing a good document. I was trying to extend the CompetencyElementsVO (oracle.apps.per.selfservice.appraisals.server.CompetencyElementsVO) which is also using data from EO.
    I have followed all the steps but after adding attributes when I am clicking on SQL Statement I am not able to update the SQL statement the select statement is not available for editing.
    Can you please let me know that what can be the issue?

    Thanks in advance for help & support.
    Sanjay

    ReplyDelete
    Replies
    1. Hi Sanjay,

      I am trying to do the same thing, extented the CompetencyElementsVO. Were you able to do it?

      Please let me know.

      Thanks,
      Priya

      Delete
  3. Hi,

    My requirement is similar to yours.

    I want to avoid entering "HOME" as deliver to location on checkout summary page.

    I extended the LOVVO - LocationOneTimePurchaseLovVO for Deliver to location. It is working correctly and is not allowing me to select HOME deliver to location.

    However, when the Checkout Summary page loads the deliver to location is already defaulted to location "INDIA - HOME OFFICES" which is defined in my assignment.

    I want to check if the default deliver to location is HOME location, If yes then set it to NULL so that user will need to select another location.

    Can you please let me know how can I achieve this?

    Thanks,
    Abhijit

    ReplyDelete
  4. I have one question, How you're running JDeveloper in OpenSuse ?

    ReplyDelete
  5. Hi Anil,

    I have few qns regarding VO extension and item substitutions.

    1. Whenever we do item substitution through JPX Import , do we need to bounce Database node as well or just apache bounce would do ? is this the same process when we overwrite the jpx file ?
    2. whats the significance of server.xml file in our xxjava.oracle.apps.ar.bpa.presentment.server folder ?
    3. I am getting this below error after deploying my VO ext files.
    oracle.jbo.NoDefException: JBO-25002: Definition oracle.apps.ar.bpa.presentment.server.PageAM of type ApplicationModule
    Please advise.

    ReplyDelete

Note: Only a member of this blog may post a comment.