XML Publisher

Author

Name:

Madhan

E-mail:

madhan.ch@gmail.com
 

Bookmark and Share   Email

Oracle XML Publisher is a template-based publishing solution delivered with the Oracle E-Business Suite.

Overview:  Oracle XML Publisher is a template-based publishing solution delivered with the Oracle E-Business Suite. It provides a new approach to report design and publishing by integrating familiar desktop word processing tools with existing E-Business Suite data reporting. At runtime, XML Publisher merges the custom templates with the concurrent request data extracts to generate output in PDF, HTML, RTF, EXCEL (HTML), or even TEXT for use with EFT and EDI transmissions

Basic Need for XML: Consider the following scenarios

We have a RDF report with tabular layout which prints in English

New Requirements:

  1. User1 wants the same Report needs to be printed in Spanish
  2. User2 wants the Same Report needs to be printed in chart format
  3. User3 wants the Same Report output in Excel
  4. User4 wants the Same Report output to be published on intranet or internet
  5. User5 wants the Same Report output eliminating few columns and adding few other

A new RDF needs to be created for each requirement stated above or an existing RDF needs to be modified with huge amount of effort but whereas with XML Publisher it can be done very easily.

XML Publisher separates a reports data, layout and translation components into three manageable pieces at design time; at runtime all the three pieces are brought back together by XML Publisher to generate the final formatted, translated outputs like PDF, HTML, XLS and RTF. In future, if any there is any change in layout we just need to add/modify the Layout file

XML Publisher

  XML Publisher

Data Logic  Data extracted from database and converted into an XML string.

Layout - The layout templates to be used for the final output are stored and managed in the Template Manager.

 Translation -The translation handler will manage the translation that is required at runtime

In brief the steps are as follows:-
a.    Create a procedure and register it as Concurrent Program so that we write XML  tags  into output file.
b.    Build a Data Definition & XML Template using XML Publisher.
c.    Create a relation between XML Template & Concurrent Program and run the concurrent program

Requirements for XML Data Object Reports

  1. Oracle XML Publisher Release 5.5 patch 4206181
  2. Template Builder 5.5

Template builder is used to create template/layout for your report. Usually Template builder 5.5 is available in Oracle XML Publisher patch itself but you can also download it from http://edelivery.oracle.com. First select Oracle Application Server Products then select your platform and then locate the Oracle XML Publisher Release 5.6.2 Media Pack v1 for Microsoft Windows, as below:

XML Publisher

Download the Desktop edition from the below:

XML Publisher

When you download the XML Publisher Desktop edition you get a Zip file containing setup for  XML Publisher Desktop Install Shield, this installs some components into Microsoft Word.

XML Publisher

After installing, the Word Add-Ins is attached to the menu bar for the word document. This menu lets you attach an XML data source document, add the XML data to your template, set preferences and preview the output.

XML Publisher

In detail along with screenshots:-

A concurrent program is written that spit out an XML file as output such concurrent program can be of type SQL or PL/SQL or Oracle Report or any other supportable type, provided it can produce a XML output.

1. Here I have a very simple PL/SQL procedure, which fetch the records from AR tables and write the output in xml tags.

CREATE OR REPLACE PROCEDURE APPS.Demo_XML_Publisher (errbuf VARCHAR2,retcode NUMBER,v_customer_id VARCHAR2)

AS

/*Cursor to fetch Customer Records*/

CURSOR xml_parent

IS

SELECT   customer_name , customer_id

FROM      ra_customers

WHERE   customer_id = to_number(v_customer_id);

/*Cursor to fetch customer invoice records*/

CURSOR xml_detail(p_customer_id1 NUMBER)

IS

SELECT ra.customer_trx_id customer_trx_id, ra.ship_to_customer_id ship_to_customer_id, ra.trx_number trx_number,aps.amount_due_original ams

FROM  ra_customer_trx_all ra, ar_payment_schedules_all aps

WHERE  ra.ship_to_customer_id = p_customer_id1

AND aps.customer_trx_id = ra.customer_trx_id

AND      ROWNUM<4;

BEGIN

/*First line of XML data should be <?xml version="1.0"?>*/

 FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<?xml version="1.0"?>');

 FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<CUSTOMERINFO>');

 FOR v_customer IN xml_parent

 LOOP

  /*For each record create a group tag <P_CUSTOMER> at the start*/

 FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<P_CUSTOMER>');

 /*Embed data between XML tags for ex:- <CUSTOMER_NAME>ABCD</CUSTOMER_NAME>*/

  FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<CUSTOMER_NAME>' || v_customer.customer_name 

                                || '</CUSTOMER_NAME>');

 FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<CUSTOMER_ID>' || v_customer.customer_id ||

                                   '</CUSTOMER_ID>');

      FOR v_details IN xml_detail(v_customer.customer_id)

      LOOP

     /*For  customer invoices create a group tag <P_INVOICES> at the

       start*/

           FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<P_INVOICES>');

           FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<CUSTOMER_TRX_ID>' || 

                   v_details.customer_trx_id || '</CUSTOMER_TRX_ID>');

           FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<CUSTOMER_ID>' ||

                           v_details.ship_to_customer_id || '</CUSTOMER_ID>');

           FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<INVOICE_NUMBER>'||

                                            v_details.trx_number||'</INVOICE_NUMBER>');

           FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<AMOUNT_DUE_ORIGINAL>'||

                                            v_details.trx_number||'</AMOUNT_DUE_ORIGINAL>');

      /*Close the group tag </P_INVOICES> at the end of customer invoices*/

           FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'</P_INVOICES>');

      END LOOP;

/*Close the group tag </P_CUSTOMER> at the end of customer record*/

 FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'</P_CUSTOMER>');

 END LOOP;

 /*Finally Close the starting Report tag*/

 FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'</CUSTOMERINFO>');

  exception when others then

 FND_FILE.PUT_LINE(FND_FILE.log,'Entered into exception');

END Demo_XML_Publisher;

/

2. Create an executable SampleXmlReport for the above procedure Demo_XMML_Publisher.

Go to Application Developer Responsibility->Concurrent->Executable

XML Publisher

3. Create a new concurrent program SampleXmlReport that will call the SampleXmlReport executable declared above. Make sure that output format is placed as XML.

      Go to Application Developer Responsibility -> Concurrent ->Program

XML Publisher

4. Make sure we declare the parameters for the procedure.

XML Publisher

5. Add this new concurrent  program with Receivables request group. Either using the following code or through below application screen.


DECLARE
BEGIN
FND_PROGRAM.add_to_group
    (
     PROGRAM_SHORT_NAME  =>'CUST_XML_SAMPLE'
    ,PROGRAM_APPLICATION =>'AR'
    ,REQUEST_GROUP       => 'Receivables All'
    ,GROUP_APPLICATION   =>'AR'
    ) ;    
  commit;
exception 
    when others then
           dbms_output.put_line('Object already exists'); 
END ;
/

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

XML Publisher

6. From the receivables responsibility (depends on which responsibility we added our concurrent program here it is receivables)

From the menu View->Requests->Submit A New Request->Single Request

XML Publisher

Note: The layout field is blank as we haven’t attached any Template or layout to this concurrent program yet.

By submitting the above request we get the output in xml (depending on procedure) as follows:

   <?xml version="1.0" ?>

- <CUSTOMERINFO>

- <P_CUSTOMER>

  <CUSTOMER_NAME>UNIV OF CHICAGO HOSP</CUSTOMER_NAME>

  <CUSTOMER_ID>1119</CUSTOMER_ID>

- <P_INVOICES>

  <CUSTOMER_TRX_ID>929476</CUSTOMER_TRX_ID>

  <CUSTOMER_ID>1119</CUSTOMER_ID>

  <INVOICE_NUMBER>2484403</INVOICE_NUMBER>

  <AMOUNT_DUE_ORIGINAL>8000</AMOUNT_DUE_ORIGINAL>

                      </P_INVOICES>

- <P_INVOICES                 

  <CUSTOMER_TRX_ID>929374</CUSTOMER_TRX_ID>

  <CUSTOMER_ID>1119</CUSTOMER_ID>

  <INVOICE_NUMBER>2484267</INVOICE_NUMBER>

  <AMOUNT_DUE_ORIGINAL>380.68</AMOUNT_DUE_ORIGINAL>

  </P_INVOICES>

- <P_INVOICES>

  <CUSTOMER_TRX_ID>806644</CUSTOMER_TRX_ID>

  <CUSTOMER_ID>1119</CUSTOMER_ID>

  <INVOICE_NUMBER>2421373</INVOICE_NUMBER>

  <AMOUNT_DUE_ORIGINAL>615.96</AMOUNT_DUE_ORIGINAL>

  </P_INVOICES>

  </P_CUSTOMER>

  </CUSTOMERINFO>

7. Save the above code as SampleXmlReport.xml

Note: Before saving the XML string in notepad remove the dashes -

8Create Template/Layout for the report using Template Builder. Here is a sample template.

XML Publisher

Note the following:

The data fields that are defined on the template

   For example: Customer Name, Customer Id

The elements of the template that will repeat when the report is run.

   For example, Customer trx id , Invoice Number and Original Amount Due. All these fields on the template will repeat for each Employee that is reported.

9. Mark up your template layout.

   Like a mail-merge document there's placeholders for the data you're going to add, and then you can add whatever formatting you like.

10. Now the next step is to select Data > Load XML Data from the toolbar menu, then pick up the XML data a file ie.SampleXmlReport.xml. Once the data is loaded, a "Data Loaded Successfully" dialog box comes up and you can then start adding data items to the template.

XML Publisher

11. To add data items from the XML file into your report, you locate in the document the placeholder for the field you're going to add, highlight it and then select Insert > Field from the toolbar. A dialog box comes up with all of the available data items, you select the one you want and click insert as shown below:

XML Publisher

12. You can add repeating rows into your document by selecting Insert > Table/Form from the toolbar. This brings up a different dialog box that lets you drag a parent node - in this case, "P Invoices" - into the middle section, which becomes your repeating rows.

XML Publisher

13. Calculate the average for amount due original. Select Insert->Field from the Add Ins toolbar. Then select the tag that calculates the average for that particular field.

XML Publisher

14. Once we are done with adding up all the fields in the template save it as an rtf which looks as below:

XML Publisher

To confirm the output from the template we build.  Click on preview and select the type in which format the output is required.

15. Adding the Template to ORACLE Application.

In order to add the template to application the user should have the responsibility XML Publisher Administrator assigned.

In this step we do 2 processes, registering concurrent program as Data Definition in template manager

And register the template using the data definition created.

XML Publisher

Go to XML Publisher Administrator->Data Definitions->Create Data definition.

Here we fill all the details to create data definition

XML Publisher

NOTE: Make sure the code of the data definition must be the same as the short name of the Concurrent Program we registered for the procedure. So that the concurrent manager can retrieve the templates associated with the concurrent program

We can add our xml file SampleXmlReport.xml in data definition here:

XML Publisher

16. Now create the template with the help of template manager

At the runtime the concurrent managers request interface will present the list of available templates with respect to the data definition registered. We will upload the rtf template file created here. We will select the language and territory.

XML Publisher

We can upload different templates for different languages and territories.

17. Now run the concurrent program to get the desired output.

From the receivables responsibility, use the submit request form to run the concurrent request.

The default layout is displayed which we can change as per the requirement. For changing the template click on options to look for all templates register with that concurrent program.

XML Publisher

Here in the above example my template is SampleXmlReport which is displayed in layout field.

XML Publisher

And once the request is submitted we will get the output in PDF as

XML Publisher

This is the final output as desired in the PDF format.



Sadiq

commented on 6/15/2009 8:42:23 AM

It is for basic level only

   

sravanthi

commented on 6/22/2009 5:17:45 AM

Hey ,
thanks for the documentation.It will be use ful for all of us.good work:)

   

prasad

commented on 6/23/2009 9:12:29 AM

Good work , Keep it up

   

jithen

commented on 7/8/2009 6:17:05 AM

Thanks prudhvi for providing the detail information regarding XML report, but for me i could get desired or required template in option button in submit request form. is there any profile to be set

   

shivdeep

commented on 7/27/2009 1:41:38 AM

Hi,

Its a nice post for beginnners to understand the XML Publisher....
Can anybody add something to it about
>> adding multiple layouts to a report....
>> how to use condotional formatting in XML etc

Thanks in advance
Shivdeep Singh

   
sunaina Commented
plz let me know
>> adding multiple layouts to a report....
>> how to use condotional formatting in XML etc

Piyush Patel

commented on 7/31/2009 3:59:10 AM

XML Publisher Steps

   

Lakshminarayana

commented on 8/7/2009 12:28:38 AM

How to use multiple layouts in XML?

   

SUNAINA

commented on 9/27/2009 2:31:19 PM

does any 1 knows how to use
>> adding multiple layouts to a report....
>> how to use condotional formatting in XML etc
plz let me kno more abt XML

   

s.ponnekanti

commented on 10/9/2009 1:12:41 AM


Dear Friends,
i Am new to ERP Schools.

i have a document to handle multi layouts in XML but i dont have permitions to Post the artical. Plz advice me how will i post the artical. or send your mail id if you require the Document.

Thanks & regards,
samba Ponnekanti

   
Arash Commented
Hi,

I would ask u if u could send me that document to handle multi layouts in XML.

Best regards,
Arash

Arash Commented
My mail: arash.kaviani.a@gmail.com

Sudham Commented

Hi Samba
I would ask u if u could send me that document to handle multi layouts for XML publisher and Its great helpful is send others documents related to XML Publisher

Best regards,
Sudham.

Commented
Hi Kanti,

Request you to send multilayout handling report document to my my mail id
tanzisadiq@gmail.com

Thanks
Sadiq

Sateesh

commented on 10/21/2009 2:47:41 AM

Hi Samba,

Please send me multi layouts in XML document to my mail id (s.sateeshkumar@igate.com).

Thanks & Regards,
Sateesh

   
Commented
Hi sateesh

That Document was already post in ERP Schoos please verify the same.
Thanks & Regards
Samba Ponnekanti

venkatesh

commented on 12/11/2009 1:39:38 AM

Thanks prithvi,if u add some more documents how to add multiple documents in xml it ill bevery useful.

   

psatya

commented on 12/15/2009 1:19:02 PM

it is a awesome document for the new entries..

   

pavan

commented on 4/6/2010 10:04:13 AM

hi,
my question is how to add images to templte?

   

Balwant Singh

commented on 4/22/2010 1:57:06 AM

Hi,
It's very helpfull doc to understand the XML Publisher.
Thanks

   

Pushpendra

commented on 4/30/2010 1:50:07 AM

Its really helping for ever one .

Thanks,
Pushpendra

   

Rashmi Adikane

commented on 8/9/2010 8:39:49 AM

I have a conc program w/ executable type SQL*PLUS (Its a SQL report file). I have created the program.. output to XML ...attached the template. this is the error The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.


--------------------------------------------------------------------------------

Invalid at the top level of the document. Error processing resource

Any thoughts on this

   

Raj

commented on 8/12/2010 7:23:49 AM

Just want to share another article on Submitting BI Publisher Concurrent Program from PL/SQL

http://www.adivaconsulting.com/adiva-blog/item/8-bip_concurrent_program_plsql

Raj
www.adivaconsulting.com

   

RAFI SYED

commented on 8/30/2010 3:09:42 AM

Thanks a lot man.you have done a great job.Please send me multi layouts in XML document to my mail id (syedmca34@gmail.com).i would be thankful to you if u send me as early as possible.

   
1
Comments Box

Name:

Email: