0% found this document useful (0 votes)
132 views

Registration of XML Report

This document describes how to create XML templates in Oracle using data templates. The key steps are: 1. Design an XML data template file with elements like parameters, data query, data structure, and triggers. 2. Create a concurrent program to generate XML output from the data template. 3. Define a data definition and associate the concurrent program and data template. 4. Run the concurrent program to generate XML data and preview the output using a BI Publisher template designed in Microsoft Word.

Uploaded by

Fathi al bsomy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
132 views

Registration of XML Report

This document describes how to create XML templates in Oracle using data templates. The key steps are: 1. Design an XML data template file with elements like parameters, data query, data structure, and triggers. 2. Create a concurrent program to generate XML output from the data template. 3. Define a data definition and associate the concurrent program and data template. 4. Run the concurrent program to generate XML data and preview the output using a BI Publisher template designed in Microsoft Word.

Uploaded by

Fathi al bsomy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 23

XML Using Data Templates

Through XML Tags:


Steps to be followed when dealing with Data Template:

 Design the Data Template XML File.


 Create data definition
 Define concurrent Program to generate the Data XML File.
 Add Concurrent Program to required module request group
 Create Template
 Add Template to data definition
 Run the Concurrent Program to see the output
Design the Data Template XML File:
SQL Query to develop BI Publisher Report

 The XML/BI publisher requires a template layout and data XML to generate the report
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 result of that SQL Statement is
published as XMLP Output.
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.
Data Template Structure:
Sample Data Template:
 Data Template is the means by which we inform the data engine to fetch the data of our
interest. Apart from these, data template also contains other elements. To make our
example simple and easy to understand, lets deal with the above 4 elements.
Data Template Declaration:
The <dataTemplate> element is the root element. It has a set of related attributes expressed
with the <dataTemplate> tag.

Attribute Name Description


Name (Required) Enter the data template name
Description (Optional) Enter a description of this data template
version (Required) Enter a version number of this data template
defaultPackage This attribute is required if your data template contains lexical references or any other ce
The default data source reference for the entire data template. Required in the following
 XML Publisher Enterprise implementations: Always required
dataSourceRef  Oracle EBS implementations: Required only when performing a distributed query acr
Define Parameters:
<parameters>
<parameter name=”department” dataType=”number” defaultValue=”10”/>
</parameters>

Attribute Name Description


name Required. A keyword, unique within a given Data Template, that identifies the parameter
Optional. Specify the parameter data type as “character”, “date” or “number”. Default va
the following three formats (based on the canonical ISO date format) are supported:
 YYYY-MM-DD
 YYYY-MM-DD HH24:MI:SS
dataType  YYYY-MM-DDTHH24:MI:SS.FF3TZH:TZM
defaultValue Optional. This value will be used for the parameter if no other value is supplied from the
Lexical References:
You can use lexical references to replace the clauses appearing after SELECT, FROM,
WHERE, GROUP BY, ORDER BY, or HAVING. Use a lexical reference when you want
the parameter to replace multiple values at runtime.
Create a lexical reference using the following syntax:
&parametername
Define the lexical parameters as follows:
Before creating your query, define a parameter in the PL/SQL default package for each
lexical reference in the query. The data engine uses these values to replace the lexical
parameters.
Create your query containing lexical references.

For example:
Package employee
AS
where_clause varchar2(1000);
…..
Package body employee
AS
…..
where_clause := ‘where deptno=10′;
…..

Data template definition:


<dataQuery>
<sqlstatement name=”Q1″>
<![CDATA[SELECT ENAME, SAL FROM EMP &where_clause]]>
</sqlstatement>
</dataQuery>

Data Query:
Use <sqlStatement name=””> to define query Performing operations in SQL is faster than
performing them in Data Template or PL/SQL. The following are the most common cases
where using SQL would improve performance:
Use a WHERE clause instead of a group filter to exclude records.
Perform calculations directly in your query rather than in template.
Example: Data Query
<parameters>
<parameter name=”p_DeptNo” dataType=”character” />
</parameters>
<dataQuery>
<sqlStatement name=”Q1″>
<![CDATA[
SELECT d.DEPTNO,d.DNAME,d.LOC,
EMPNO,ENAME,JOB,MGR,HIREDATE,SAL
from dept d, emp e
where d.deptno=e.deptno
AND d.deptno = nvl(:p_DeptNo,d.deptno) ]]>
</sqlStatement>
</dataQuery>

Data Triggers:
<dataTrigger name=”beforeReport” source=”employee.beforeReport()”/>
<dataTrigger name=”beforeReport” source=”employee.beforeReport(:Parameter)”/>

Attribute Name Description


name The event name to fire this trigger
source The PL/SQL pkg.fun() where the executable code resides

Data triggers execute PL/SQL functions at specific times during the execution and generation
of XML output. Data triggers are optional, and you can have as many <dataTrigger>
elements as necessary. The <dataTrigger> element has a set of related attributes. These are
expressed within the <dataTrigger> tag.

For example, the name and source attributes are expressed as follows:
<dataTrigger name=”beforeReport” source=”employee.beforeReport()”/> <dataTrigger
name=”beforeReport” source=”employee.beforeReport(:Parameter)”/>
The location of the trigger indicates at what point the trigger fires.

The Data Structure Section:


In the data structure section you define what the XML output will be and how it will
be structured. You can do the following:
 Create break groups:
Order By in SQL query should be set
 Apply group filters:
WHERE clause should be use instead of a group filter

 Create summary columns:


Sum, Average, Count, Maximum and Minimum

Example:
<group name=”G_DEPT” source=”Q1″
groupFilter=”empdata.G_DEPTFilter(:DEPT_NUMBER)”>
<element name=”DEPT_NUMBER” value=”DEPTNO” />
<element name=”DEPTSAL” value=”G_EMP.SALARY” function=”SUM()”/>
<group name=”G_EMP” source=”Q2″>
<element name=”EMPLOYEE_NUMBER” value=”EMPNO” />
<element name=”NAME” value=”ENAME”/>
<element name=”JOB” value=”JOB” />
<element name=”SALARY” value=”SAL”/>
</group>
</group>

Linking Queries:
Two ways of linking are supported

 Bind variables in your query


 Link element <link name=”” ……../>

Example: Using Link tag


<dataQuery>
<sqlStatement name=”Q1″>
<![CDATA[
SELECT DEPTNO,DNAME,LOC from dept where &pwhereclause order by deptno ]]>
</sqlStatement>
<sqlStatement name=”Q2″>
<![CDATA[
SELECT EMPNO,ENAME,JOB,MGR,HIREDATE,SAL from EMP ]]>
</sqlStatement>
<link name=”DEPTEMP_LINK” parentQuery=”Q1″ parentColumn=”DEPTNO”
childQuery=”Q2″ childColumn=“DEPTNO“condition=”=”/>
</dataQuery>
Defining Data definitions:
 For this we should add XML publisher responsibility to user.
 Then switch to that responsibility.
 Then go through the following navigation for defining Data definition
 HOME –> Datadefinitions
Then it displays form as below

Click on Create Data Definition and the below window pops up


In the above form we have to give code and use the same code as concurrent program short
name.
After creating data definitions then click on Apply.
Define a Concurrent Program to generate the Data XML File.
Using Responsibility System Administrator –> Concurrent –> Program –> Define.
Define a Concurrent Program With executable = XDODTEXE and Output Format = XML.

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.
Associate the Concurrent Program to a request group.

Go to System Administrator -> Security -> Responsibility -> Request


In the form we have to give code and use the same code as concurrent program short name.
Then attach Data Template designed
Then Go to Purchasing Vision Operations and Run the Concurrent Program PO_TEMPREF
Concurrent Program completed successfully

And the output is given below which is to saved in .xml format


<PO_DETAILS>
<P_PO_NO>1621</P_PO_NO>
<LIST_G_NAME>
<G_NAME>
<PURCHASEORDER_NO>1621</PURCHASEORDER_NO>
<SUPPLIER>Advantage Corp</SUPPLIER>
<PURCHASEORDER_STATUS>Approved</PURCHASEORDER_STATUS>
<BILL_TO>V1- New York City</BILL_TO>
<BILL_TO_ADDRESS>90 Fifth Avenue, New York, NY</BILL_TO_ADDRESS>
<ORDERED_BY>Smith, Mr. Jonathan</ORDERED_BY>
<LIST_G_TYPE>
<G_TYPE>
<ITEM_DESCRIPTION>Latex Gloves</ITEM_DESCRIPTION>
<UNIT_OF_MEASURE>Each</UNIT_OF_MEASURE>
<ITEM_NAME>MS15701</ITEM_NAME>
<QUANTITY>30</QUANTITY>
<PRICE>.55</PRICE>
<TOTAL>16.5</TOTAL>
</G_TYPE>
<G_TYPE>
<ITEM_DESCRIPTION>Latex Gloves</ITEM_DESCRIPTION>
<UNIT_OF_MEASURE>Each</UNIT_OF_MEASURE>
<ITEM_NAME>MS15701</ITEM_NAME>
<QUANTITY>30</QUANTITY>
<PRICE>.55</PRICE>
<TOTAL>16.5</TOTAL>
</G_TYPE>
………….
</LIST_G_TYPE>
</G_NAME>
</LIST_G_NAME>
</PO_DETAILS>

Next
Go to XML Publisher Responsibility and edit the data definition created earlier and upload
the downloaded .xml file
Next
Use Microsoft Word BI Publisher to design the template
Load the xml data downloaded above as given below
Click on Add-Innsà Dataà Load XML Data
I presume that all visiting here has the understanding of inserting fields I’m roughly giving
you the final design
After designing the template Preview the template and save it in .rtf format.

After the designing part


Again Go to XML Publisher Responsibility -> Templates -> Create Template
Code is the Concurrent Program Short Name
Data Definition is the previously created Data Definition
We are linking Template and Data Definition here in this part

I actually happened to enter the incorrect data definition name which I updated in the next
slide
After completing the XML part
Now again go to Purchasing Vision Operations and submit the request
One can view the Template created in XML Publisher Responsibility here in the layout tab
Concurrent Program executed successfully

The Output:

You might also like