Tuesday, 28 February 2017

Manipulating OA Footer

Manipulating OA footer region


How to render copyright information and privacy statement for custom page?

To render standard footer just Set the Auto Footer property in the pageLayout region to 'True'. This will render the Footer with default copyright information and privacy statement.

To render different privacy statement and copyright information
1. Set the Auto Footer property in the pageLayout region to 'False'
2. Right click pageLayout region and select New -> Copyright
3. Right click pageLayout region and select New -> Privacy



How to display "About this page" link?

Set FND: Diagnostics profile option to 'Yes'.
This profile option renders "About this Page" link at the botton left corner of the page and Diagnostics link at the top right corner of the page.



How to personalize page footer items such as Privacy Statement, copyright, standard footer?

This personalization is somewhat tricky because the navigation to this item is different from normal personalization.

Follow these steps to personalize the OA footer
1. Login in SSHR.
2. Select Personalize Page link at top right of page.
3. Select Choose context button.
4. In the scope drop down box select OA Footer.
5. Click on apply.
6. Expand all if its not already expanded.
7. Now you can see all the footer elements.
8. Click on personalize pencil icon and personalize the desired items.



How to display custom copyright infomation in the standard page?

You can edit the copyright information in sshr by updating fnd_new_messages table
select message_text from fnd_new_messages where message_name='JTF-COPYRIGHT';

Other way is just personalize the page and update the prompt in copyright item.

How to Call a Concurrent Program from OA framework

OA Framework provides the ConcurrentRequest class to call the concurrent program from the page. The submitRequest() method in the ConcurrentRequest class takes 6 parameters and returns request id of the submitted concurrent request:

public int submitRequest
String ProgramApplication ,
String ProgramName ,
String ProgramDescription ,
String StartTime,
boolean SubRequest,
Vector Parameters ) throws RequestSubmissionException

ProgramApplication -Application Short name of application under which the program is registered.
ProgramName - Concurrent Program Name for which the request has to be submitted
ProgramDescription - Concurrent Program Description
StartTime - Time at which the request has to start running.
SubRequest - Set to TRUE if the request is submitted from another running request and has to be treated as a sub request.
Parameters - Parameters of the concurrent Request


Here is the example for calling a concurrent program from a OA framework page.


import oracle.apps.fnd.cp.request.ConcurrentRequest;
import oracle.apps.fnd.framework.server.OADBTransaction;

public int submitCPRequest(Number headerId) {

try {


OADBTransaction tx = (OADBTransaction)getDBTransaction();
java.sql.Connection pConncection = tx.getJdbcConnection();
ConcurrentRequest cr = new ConcurrentRequest(pConncection);

String applnName = "PO"; //Application that contains the concurrent program
String cpName = "POXXXX"; //Concurrent program name
String cpDesc = "Concurrent Program Description"; // concurrent Program description

// Pass the Arguments using vector
// Here i have added my parameter headerId to the vector and passed the vector to the concurrent program

Vector cpArgs = new Vector(); 
cpArgs.addElement(headerId.stringValue()); 


// Calling the Concurrent Program

int requestId = cr.submitRequest(applnName, cpName, cpDesc, null, false, cpArgs);
tx.commit();

return requestId;

} catch (RequestSubmissionException e) {
OAException oe = new OAException(e.getMessage());
oe.setApplicationModule(this);
throw oe;

}




How to monitor the submitted concurrent request OA Framework


The Request Monitoring user interface provides the ability to search for a current user's requests. It allows the user to specify criteria to search for a request based on a specific request ID, requests for a specific program or a range of scheduled requests. Using the search results list, a user can select a request to see the details of that request or view its output file. From the Details page for a request, a user can place a hold on a pending request, cancel a pending request or view the request's log file.



You can call the Request Monitoring page by calling following URL
OA.jsp?akRegionCode=FNDCPREQUESTVIEWREGION&akRegionApplicationId=0

Deploy OA Framework

How to Deploy OA framework in the Instance

Deployment of OA framework consists of 5 steps.
  • Deploying Class files and VO/EO/AM xml files
  • Deploying PG/RN xml files
  • Deploying jpr files for Substitution
  • Setup AOL to access the page
  • Restart the server

Let's look at these one by one.

Deploying Class files


The files such as
  • Controllers *CO.class
  • Application modules *AM.class
  • View Objects *VOImpl.class, *VORowImpl.class, *VO.xml
  • Entity objects *EO.xml, *EOImpl.java

should be deployed in the $JAVA_TOP/<path of your file>.

For eg:
if your files path in jdeveloper is
$jdev_home/myprojects/oracle/apps/ap/setup/webui/setupCO.java
then place your class files in the following path in the instance
$JAVA_TOP/oracle/apps/ap/setup/webui/setupCO.class


Deploying Page and Region files


The Page xml files(*PG.xml) and region xml(*RN.xml) files resides in the database. So you have to import the file into the database to make it work in the instance. Oracle application provides XMLExporter/XMLImporter to export and import page files from and to the database.

Deploy the files to the Instance

java oracle.jrad.tools.xml.importer.XMLImporter /home/prasanna/pages/SetupPG.xml -username <data base user name> -password <data base password> -dbconnection "(description = (address_list = (address = (community = tcp.world)(protocol = tcp)(host =<hostname> ) (port = <port id>)))(connect_data = (sid = <sid>)))"

This command will import the SetupPG.xml file into the database.


Extracting from instance

If you have done your personalizations in the developement instance and you want to deploy the personalizations into the production instance, then you can extract the personalization using XMLExporter command from the developement instance and Import the extracted xml file into the production instance in the same way you did for PG.xml files.

java oracle.jrad.tools.xml.exporter.XMLExporter /oracle/apps/ap/setup/webui/customizations/site/0/SetupPG -rootdir <destination path> -username <data base user name> -password <data base password> -dbconnection "(description = (address_list = (address = (community = tcp.world)(protocol = tcp)(host =<hostname> ) (port = <port id>)))(connect_data = (sid = <sid>)))"

The above command will export the SetupPG from the data base to your file system at the destination path as XML file (SetupPG.xml)


Deploying jpr files for Substitutions, if any


If you have extended EO, VO or AM and created substitutions in your project. Then you have to deploy your .jpx file into the instance.

java oracle.jrad.tools.xml.importer.JPXImporter $AP_TOP/xxx/Setup.jpx -username <data base user name> -password <data base password> -dbconnection "(description = (address_list = (address = (community = tcp.world)(protocol = tcp)(host =<hostname> (port = <port id>)))(connect_data = (sid = <sid>)))"


Setup AOL to access the page


In case your page is referred in existing pages of Oracle applications you can skip this step. But if you want to access the page as a new Function then follow these steps.


Create Function as
ID: XX_SETUP
Name: SETUP
Function type(HTML tab) : SSW
URL: OA.jsp?page=/oracle/apps/ap/XXX/SetupPG&parameter1=xx&parameter1=xx


Attach the function to a Menu
Attach the menu to a Responsibility

Restart the server


After deployement you cannot see the page immediately on the server instance. This is because your Pages and class files would be cached in the middle tier. So you have to bounce the apache.

$COMMON_TOP/admin/scripts/adapcctl.sh stop
$COMMON_TOP/admin/scripts/adapcctl.sh start

After this process, clear the cache from the functional administrator responsibility and this step is optional.

Some times we may need to restart the whole middle tier to see the depolyed pages in the instance.
To Restart the instance use following command

Stop the instance
cd $INST_TOP/admin/scripts
adstpall.sh apps/apps

Start the instance
adstrtal.sh apps/apps

How to hide a mandatory field in OAF Page

If the business wants to hide a field in the seeded page, you can do it by personalizing the page and set Rendered property to false.
But this solution will not help you if the field is marked as mandatory by the seeded page.

The reasons are Mandatory Validations are usually done at the EO level. Hence even if you hide the mandatory field, the validation would still happen at the server. If the column has not null constraint in the table, it will throw a database error.


Can I extend the VO or EO and remove the mandatory property?
No, you cannot change the mandatory property through extension.


How to fix this?You can fix this by setting a default value for the mandatory field.


Should I extend the VO/EO and set the default value?
Do not extend the VO/EO for the defaulting logic. Because extensions are applied at the site level and the Oracle seeded pages share the same VO/EO all over the Applications.


Where to default the value?

Extend the controller and set the value in the processRequest(){} method. This is the safest way to default the value to the mandatory field.

After defaulting the mandatory variable, personalize the page and set the rendered property to false.

How to Call a PL/SQL block from OA framework

You can call PL/SQL block from the OA Framework using callable statement. Use the following code from application module.


import java.sql.CallableStatement;
import oracle.apps.fnd.common.VersionInfo; 
import 
java.sql.SQLException;
 

CallableStatement 
updateStmt = null;
 
try
 {
// Put your PL/SQL block in a String variable. 

String 
deleteStmt = "begin delete test_table where header_id = :1; "+
" :2 = xxx_pkg.yyy_function(); end;"; 

OADBTransaction 
txn = getOADBTransaction();

// Pass the PL/SQL block to the callable Statement 

updateStmt = txn.createCallableStatement(deleteStmt, 1);

// Set all the bind variables before calling the execute command 

updateStmt.setInt(1, headerIdToDelete);
// And register the output parameter types
updateStmt.registerOutParameter(2, Types.DOUBLE);

updateStmt.executeUpdate(); 
// After execute you can get the value of pl/sql block output
Number amount = new Number(updateStmt.getDouble(2));
updateStmt.close();
 
// Commit the transaction in the database
txn.commit();

catch(SQLException sqle) { 
updateStmt.close();
 
}



If you want to call pl/sql from the controller then get the application module from the pageContext.
And then get the db transaction from the application module
OADBTransaction txn = pageContext.getApplicationModule(webBean).getOADBTransaction();