Monday, April 10, 2017

Creating XSL Sub Template and Include XSL template in RTF

Creating XSL Sub Template and Include it in RTF


In this article we shall see 
  1. How to create XSL sub template 
  2. How to import XSL sub template in RTF template.
  3. How to invoke template in XSL file, from RTF template

PREREQUISITE STEPS

Prerequisite steps include following
1.       Creating Concurrent Program Executable
2.       Creating Concurrent Program Definition
3.       Creating Data Definition.

Above steps will make sure that we have all required components which can give sample XML data for testing.

STEP1 – CREATING XSL-FO SUB TEMPLATE


Navigate to “XML Publisher” responsibility -> Templates tab and create template with details as shown below:-


Contents of file which is attached to this template is shown below:-

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:decimal-format name="euro" decimal-separator="," grouping-separator="."/>
  <xsl:template name="formatnumber">
    <xsl:param name="NUMBERTOFORMAT"/>
    <xsl:value-of select="format-number($NUMBERTOFORMAT, '###.##.###,00', 'euro')"/>
  </xsl:template>
</xsl:stylesheet>

Above code formats given number into European format(in which group separator is dot and decimal separator is comma)

STEP2 – CREATING MAIN TEMPLATE(RTF TEMPLATE)

Navigate to “XML Publisher” responsibility -> Templates tab and create template with details as shown below:-


Contents of the RTF file is shown below, which contains “Import” statement for importing “XXCUST_FORMAT_NBR_XSL” template created in Step 1. Snapshot of RTF file is shown below:-



 As shown in above screenshot, XSL-FO template is imported into RTF template using below syntax

 <?import:xdo://XXXX.XXCUST_FORMAT_NBR_XSL.en.US/?> 

XXXX must be replaced with Application name of XSL-FO template.

Import statement for running the BI publisher output from RTF using “Preview” option(in MS Word), will be as below:-

<?import:file:///E:/Vani/xsl/XXCUST_FORMAT_NBR_XSL.xsl?>

XXCUST_FORMAT_NBR_XSL.xsl file resides in E:\Vani\XSL location

Template is invoked using below syntax

<xsl:call-template name=”formatnumber”>   
      <xsl:with-param name="NUMBERTOFORMAT" select="BEGIN_BAL"/> 
</xsl:call-template>

Report output and sample XML are shown below :-

<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated by Oracle Reports version 10.1.2.3.0 -->
<XXCUST_FORMAT_NBR>
  <LIST_G_COMPANY>
    <G_COMPANY>
      <BEGIN_BAL>5000000</BEGIN_BAL>
      <END_BAL>123242342.43</END_BAL>
    </G_COMPANY>
    <G_COMPANY>
      <BEGIN_BAL>56778.43</BEGIN_BAL>
      <END_BAL>2323223</END_BAL>
    </G_COMPANY>
    <G_COMPANY>
      <BEGIN_BAL>788778.45</BEGIN_BAL>
      <END_BAL>1111</END_BAL>
    </G_COMPANY>
  </LIST_G_COMPANY>
</XXCUST_FORMAT_NBR>



You can download XSL-FO template and RTF template from here.

Friday, April 7, 2017

OAF Customization/Extension Standards


OAF Customization/Extension Standards


1.       Create only one custom folder under $JAVA_TOP, lets say $JAVA_TOP/xxcust

In order to do so :-
a.  Create a custom directory(for ex:- xxcust) on Application server under $JAVA_TOP
b.  All the custom java files and .xml files will reside inside $JAVA_TOP/xxcust folder

            Having one custom folder will ensure that custom files will be centrally located and will not mingle with any of the directories which contain Oracle provided standard files.

2.       Custom Java files Package Name Naming Convention


As all custom java files reside in $JAVA_TOP/xxcust folder, hence, custom java files must follow following naming convention for package name for ex:-


3.       Custom Java files Naming Convention


a.    All Java file names must begin with first letter being capital letter.
b.    All custom Java files or .XML files will begin with XXCust(or XXCUST) for ex:- XXCustReqLinesVO.xml and XXCustReqLinesVOImpl.java
c.     If Custom java files or XML files extend Standard VO(i.e. oracle provided) then custom java file name must be prefixed with XXCust, followed by standard VO.xml or VOImpl.java name for ex:-

If we are writing custom VO which extends oracle.apps.icx.por.wf.server.ReqLinesNotificationsVO i.e. oracle provided standard VO, then custom VO Name should be
XXCustReqLinesNotificationsVO which resides in xxcust.oracle.apps.icx.por.wf.server package

4.      New attributes added to View Objects during extension


Ensure that the new attributes that you add to view object during extension begin with xx. It then becomes very easy for any other developer to identify the custom columns. Some VO's are developed by Oracle in expert mode that are not too upgrade safe. Therfore identification of the custom attributes is very important.

5.      OA Framework Deployments


When Oracle delivers their code, they do not provide java files in $JAVA_TOP. However for our custom code we need to decide if we will deploy java files on file system or will leave them within the source control itself. Whatever may be the approach followed, we should be consistent with that approach. Whatever, may be the approach, custom Java Source code must be kept safe either in source control or in server so that whenever new changes are required to be done in custom code we have correct version of custom code in place to start with.

6.      Working on Existing Custom Code


Whenever there are new changes which involve modifying existing custom code, for ex:- custom VO, EO, CO etc.. We pick the latest java source files and .XML files from source control (if maintained) or from server (if java source files moved to server) and modify existing custom java files or XML files. And redeploy the changed custom java/xml files into server. Move the changed java/XML files to source control, as the case may be.

7.      Debugging


          All custom code we write should leverage FND Logging technique using fnd_log.string in PL/SQL and writeDiagnostics in Java. You must not re-invent the wheel for debugging custom code, as a great framework for debug logging comes out of the box in eBusiness Suite.