XML Publisher and Data Template - SQL Query to develop BI Publisher Reports

The XML Publisher(XMLP / BI Publisher ) requires a Template layout and Data XML to generate the report in PDF, EXCEL, RTF or HTML format .The Data XML can be generated from Oracle Report, OA Framework and Data Template.
Using this approach, you can develop BI Publisher reports in Oracle EBS, without having to develop an RDF report.
You can specify an SQL Statement in an XML file, and results of that SQL Statement are published as XMLP Output.


In this article lets understand the usage of Data Template with a small demo. In the next article we will discuss in detail the Data Template XML Schema.
The data template is the XML document whose elements communicate the following information to the data engine.
  • Data Query : The SQL query with bind parameter specifying the data to be fetched.
  • Bind Parameters : Definition of each bind parameter defined in the query.
  • Data Structure : Definition of the Output XML Structure.
  • Data Triggers : Triggers that should be executed before or after the data query execution. Triggers are used to either do initialization or do some post query operation.


Hence Data Template is the means by which we inform the data engine to fetch the data of our interest. Apart from the these , data template also contains other elements. To make our example simple and easy to understand, lets deal with the above 4 elements.


Sample Data template :


XML Publisher Data Template Architecture

The Data engine execute the Data template to generate the Data XML file . The Data XML file is then merged with the Template layout by the XMLP engine to generate the XMLP
Report.


Lets try to build a sample XMLP report to display Employee Details. The Following are the steps involved


Step 1: Design the Data Template XML File.
Step 2: Create the Data Definition in XML Publisher and associate it with Data Template
Step 3: Define a Concurrent Program to generate the Data XML File.
Step 4: Define the RTF Template using the Generated Data XML.
Step 5: Registering the Template with XML Publisher
Step 6: Execute the concurrent program to generate the PDF report.


Step 1 : Design the Data Template XML File.
This Data Template selects the employee details from the EMP table. The select query specifies the columns of interest. It uses a bind parameter to filter the employees of a particular department.


For each bind parameter in the query , we need to define a Parameter. In this case we have defined p_DeptNo parameter.


In the data structure element, we have defined the output XML structure. He we map the columns in the select query with the data xml elements.


Step 2 : Create the Data Definition in XML Publisher and associate it with Data Template
Using Responsibility: XML Publisher Administrator --> Home --> Data Definitions --> Create Data Definition


Screen 1 : Enter the data definition Details and click on Apply. Note down the Code. The code should be used as the short name of the concurrent program.



Screen 2: Click on the "Add File" button against the "Data Template" Label.

Screen 3: Upload the Data Template XML file and Click on Apply.
Screen 4 : The Data Template is associated to the Data Definition..



Step 3: Define a Concurrent Program to generate the Data XML File.


Using Responsibility System Administrator --> Concurrent : Program --> Define.


Screen 1: Define a Concurrent Program With executable = XDODTEXE and Output Format = XML.



Screen 2: For each parameter in the Data Template, define a parameter in the concurrent program. The Data Template parameter name should match the concurrent program parameter token.
Screen 3: Associate the Concurrent Program to a request group.







Screen 4 : Execute the concurrent program "Employee Details Data Template Demo"and click on the output button get the Data XML. Save the XML file. We will use it to generate the RTF Template.



Step 4: Define the RTF Template using the Generated Data XML.


Install the Oracle XML Publisher Desktop available via patch 5887917. Open the Microsoft word. You should be able to see the following menus and toolbars.
Using the menu Data -> Load XML Data... , load the XML File generated from Jdeveloper
If the XML files gets loaded successfully, then you should get the below confirmation.



Using the Table Wizard as below to create the 'Table Report Format' with all the columns of EMP.
The Table Report Format Template should be like


Step 5: Registering the Template with XML Publisher
Responsibility: XML Publisher Administrator --> Home --> Templates --> Create Template.
Enter the Template Name and other details. The Data Definition should be the data definition defined in the above steps. Click on the apply button





Step 6 : Execute the concurrent program to generate the PDF report.
Open the concurrent program for submission and click on the option button to specify the XML Publisher Template defined in the previous step and Output type to be used. The options specified once gets stored . Hence if open the option window again, the template name and the output type will be available. Click ok button and run the concurrent program. When the program completes. Click on the Output button to see the PDF report.






1 comment:

  1. ok.... but i need two Queries template and link bw the query and groups..

    ReplyDelete

How to find all cancel Requisitions

SELECT prha . *   FROM po_Requisition_headers_all prha , po_action_history pah   WHERE      1 = 1        AND pah . object_id ...