Removing unwanted Mileage UoMs from an i-Expense Claim (Part 2)
In Part 1 of this article, we showed how to customise the values in the Mileage UoM drop-down list. However, we feel that customisations should only be used as the last resort, when all other options have been exhausted. A change to the View Object’s XML file (as suggested by Oracle) will not be resilient across patches and upgrades.
The Oracle Application Framework (OAF) provides a mechanism for us to provide a substitute definition for a View Object, With this mechanism, any time the Framework asks for the UnitOfMeasuresVO it will actually get our personalised version. The easiest way to create a personalisation of this type is to use the appropriate version of JDeveloper. You cannot use the mainstream version of JDeveloper from OTN – you need to download one that has the correct version of JDeveloper that has the OA Extension built-in (see MOS Note 416708.1 for more details).
For this article the target environment is an R12.1.3 environment, so I have JDeveloper 10g on my desktop. Once that is setup, we also need to copy the current View Object definitions locally as well. As mentioned in Part 1, the VO that we are interested in is oracle.apps.ap.oie.server.UnitOfMeasuresVO, which resides in the server-side folder $JAVA_TOP/oracle/apps/ap/oie/server. Copy the whole contents of this folder to equivalent folders under your JDeveloper myprojects and myclasses folders (which are subfolders of your JDEV_HOME).
Something else that you’ll need from the server is the DBC file for the EBS environment. This can be found in the $FND_SECURE directory and should be copied to the local JDEV_HOME\jdev\dbc_files\secure folder:
Now you can start JDeveloper and create a new Workspace (in JDev 10g these are actually called Applications, but the OA Extension still refers to Workspaces). Select File, New… from the menu and choose the Workspace configured for Oracle Applications option:
Enter some appropriate values for your environment, making sure that the Add a New OA Project is ticked. When the New Project Wizard is displayed, give the Project a suitable name. You will need to enter a value for the Default Package, but for this solution the value is not used:
On Step 3 of the Wizard, you need to select the DBC file that we downloaded earlier and enter the username and password of an EBS user. You can leave the Responsibility fields as default, as we are not actually creating a runnable project; we are just using JDeveloper to create XML and Java Class files:
Once the project is created, you will see that the files we copied from the server are now visible under the Application Sources folder. Right click on one of the folders and select New View Object…
The name of the Package that you enter on the Create View Object dialog is important. The VO that we are extending is in the package oracle.apps.ap.oie.server; we need to replicate the same path, but include a short name to indicate your organisation – for us we add pcl:
The next Step is the most important – here we can override the SQL from the original VO. In the previous article, Ian suggested a single addition to the WHERE clause, but just in case this VO is used in more than one screen (ie: with other Lookup Types), I have added some extra clauses. Once the SQL has been entered you should validate it using the Test button:
Some versions of the OA Extension have a slight issue with some older XML VO definitions. On Step 6 you may see that the Query Column Type is not correct, showing a value starting $none$; these need to be changed to reflect the datatype of the columns being selected:
On the last Step of the Wizard ensure that the Generate Java Class checkbox is ticked under the View Row Class heading – these Java classes are not necessary for BC4J, but they are required to ensure that we adhere to the Oracle Applications Development Standards:
Once the Wizard has completed it’s code generation process, you can see our new VO:
Now we need to ensure that the Framework knows to substitute in our new VO when the original is requested. This is done on the Project Properties dialog. Once displayed, find the Business Components, Substitutions page:
Under the Available heading we need to select the VO that we are overriding and on the other side we select the VO that is being substituted in:
Finally, we need to build the Project. This compiles the Java sources into CLASS files and copies them and the XML definition files from myprojects into the myclasses folder structure:
We’ve completed everything we need to do in JDeveloper – now we need to get the files back over to the right places on the Application server. We need to copy all the files in myclasses\pcl\oracle\apps\ap\oie\server to $JAVA_TOP/pcl/oracle/apps/ap/oie/server:
Finally, we need to upload the substitution information into the Metadata Store (MDS). This is stored in a file with a JPX extension. There are Java helper classes available on the server to help you to upload this:
And that’s it! If we log into EBS and go to i-Expenses, we can see that the UoM drop-down list now only has the single value that we want to display:
To confirm that the Framework is using our VO and not the original, we can click on the About this Page link and expand the Business Components References Details section.
About half way down the list of Objects we see the reference to our VO. If we click on the VO name we are shown the details of the VO and we can confirm the SQL behind the VO is the SQL that we entered earlier:
Obviously, this type of Personalisation is more complicated than the type of Personalisation that can be done using the web user interface. However, the most important thing is that this is a Personalisation and not a Customisation and so fully supported by Oracle.
Comments are now closed... Please contact us if you have any queries.