Thursday, 18 April 2013

Create XML Publisher Report Using Oracle Reports( RDF )

XML Publisher is a simple engine. It needs only 3 input values to generate report.
 
1.Data to display on report(in XML format)
2.Layout model/presentation(in XSL-FO format or RTF)
3.Final output type (PDF, Doc, HTML, etc)
Points to Note:

XML publisher doesn’t care about how you are generating xml data. Only it needs is, your actual data(text file, excel file, data in DB) must be converted in xml format(calling XML Data) as input to the engine. To get this, you can write your own xml data or use Oracle Reports to generate xml data or use any other third party tools to generate xml data from actual data.
o XSL-FO stands for Extensible Stylesheet Language Formatting Objects. Used to present XML Data in readable and user friendly format. But normal user understands very little in this, so there is an alternative i.e. user friendly RTF. You do presentation work on RTF file and give this as input to the XML Publisher engine. XML Publisher converts RTF into XSL-FO.


1. Create Oracle Report(XX_TEST.rdf)
2. Define/Register Concurrent Program(XX_TEST)
3. Create Template Definition and Template(XX_TEST.rtf)
4. Run CP and Show XML Publisher report in PDF format(XX_TEST_OUTPUT.pdf)

Step 1: Create Oracle Report(XX_TEST.rdf)
1. Open Report Builder
Follow below screen shots to complete Oracle Report creation.

2. Save file as XX_TEST.rdf. Compile and check for errors. Close Report Builder.
3. Now move this file to $AP_TOP/reports/US

Or
Keep file in local directory and set file path in profile option ‘FND: Override Directory’ at user level.

Step 2: Define/Register Concurrent Program(XX_TEST)
1.Register Executable

Navigate to System Administrator->Concurrent->Program->Executable
Provide following information as shown in the picture.
Executable: XX_TEST
Short Name: XX_TEST
Application: Payables
Execution Method: Oracle Reports
Execution File Name: XX_TEST


2.Define CP

Navigate to System Administrator->Concurrent->Program->Define
Provide following information as shown in the picture.
Program: HG-XML Publisher Test Report
Short Name: XX_TEST
Application: Payables
Executable Name: Oracle Reports
Format: XML
CP definition looks like this after creation.

Points To Note:
o Note down Executable name. We need to use this in XML Publisher definition to refer this CP.
o XML Publisher engine needs data input in XML format. So always select format as XML.( Final output will be PDF/RTF/HTML.. as selected by you in report submission.)
o Add new CP to the Request Group, then add Request Group to your Responsibilty.
Step 1: Extract XML data from CP/Create your own sample XML data(XXXXMLP-DATA.xml)
Extract XML data from CP
1.Open any existing concurrent program definition and change the Output:Format to XML.
2.Run CP. Save output(which comes in XML)
 
Or
Create your own sample XML Data(XXMLP-DATA.xml)

Step 2: Create template layout and group data in the template(RTF) file(XXMLP-TP.rtf)
1.Install XMLP_Desktop 5.5/BI Publisher Desktop 10.1.3.4.1
2.Open new MS Word document. You can see new Menus added in tool bar by BI Publisher Desktop.


3.Click menu Data->Load XML Data. Select file XXMLP-DATA.xml created in Step 1. You will get message ‘Data Loaded Successfully’


4.Click menu Insert->Table/Form. It opens screen ‘Insert Table/Form’.
Data Source: Data Source shows hierarchy of the nodes present in your xml data file(XXMLP-DATA.xml)
Template: Template shows hierarchy of the nodes you selected to show in a template layout
Properties: Each node Style, Sort By, Grouping, Sort Order, etc.
Preview: You can see preview of the layout while adjusting nodes.


5.Drag nodes from Data Source tree to Template to create table structure. When you do drag and drop, it asks for “Drop Single Node”, “Drop All Nodes”, “Cancel”.
 

6.Select “Drop All Nodes”.


7.To group invoices by VENDOR, select node ‘Invoice’ and set properties Style to ‘FreeForm’, Grouping to ‘VENDOR’ in Properties window.


8.To group invoices under vendor by Invoice_Date, select node ‘Vendor’ and set properties Style to ‘Table’, Grouping to ‘INVOICE_DATE’ in Properties window.


9.Click Ok button. You will see the table layout on the document.


10. Now add Heading and Footer to the report and save as rtf file(XXMLP-TP.rtf). Template is ready.


Step 3: Preview output in PDF/HTML/RTF/XML..(XXMLP-OUT.pdf)
1.Open XXMLP-TP.rtf created in Step 2.
2.Click menu Data->Load XML Data and select xml data file XXMLP-DATA.xml created in Step 1.
3.Click menu Preview->PDF to see the output


4.Output(Shows invoices order by vendor name and invoice date in PDF format)

Step 3: Create Template Definition and Template(XXXX_TEST.rtf)

1.Create Template Definition
Navigate to XML Publisher Administrator->Data Definitions
Click Create Data Definition button.
Provide following information as shown in the picture.
Code: XXXX_TEST
Name: HG-XML Publisher Test Report(your choice)
Application: Payables(your choice)
Click Apply.
Definition looks like this after creation.

Points To Note:
Value given in the Code field must be same as the Executable name of the CP ‘HG-XML Publisher Test Report’.
2.Create Template
Navigate to XML Publisher Administrator->Templates
Click Create Template button.
Provide following information as shown in the picture.
Code: XX_TEST(your choice)
Name: HG-XML Publisher Test Report(your choice)
Application: Payables(your choice)
Type: RTF
Data Definition: HG-XML Publisher Test Report
Upload template XX_TEST.rtf.
Click Apply
Template looks like this after creation.

Step 4: Run CP and Show XML Publisher report in PDF format(XX_TEST_OUTPUT.pdf)
1. Submit Request
If you want final output in different format(RTF, HTML, etc), click Options button and change the Format type. Default is PDF

2.CP Output(PDF)

No comments:

Post a Comment