Bursting (Email report output) in XML Publisher reports

XML Bursting is a feature available in Oracle by which a XML is exploded into different parts based on a defined logic and the individual parts are again converted into reports based on a layout and sent via email to designated mailboxes.

This is a very helpful feature especially if you are trying to send the output of a report to an email address or multiple email address

Benefits of XML bursting 1. 2. 3. 4. The feature is standard for XML Publisher version 5.6.3 No coding is required Output is sent via email. User does not need to login to Oracle to get the report The main report template and the bursting templates can be different from each other. Thus there can be one output from the concurrent program and a different layout to send as email.

Demonstration of XML bursting
We created a XML Publisher report with using a data template. The report has been developed to return 4 records. We shall use bursting to send the 4 records as 4 different reports to 4 email addresses. For our example we have used 1 email address across all 4.

XML Data Template The data template is given below,

01 <?<span class="hiddenSpellError">xml</span> version="1.0" encoding="ISO8859-1"?> <!-- $Header: XX-EMP_DET.xml 115.0 2012/03/15 08:04:42 <span 02 class="hiddenSpellError" pre="42 ">xdouser</span> noship $ --> 03 04 05 06 07 08 <!-- <span class="hiddenSpellError" pre="">dbdrv</span>: none --> <dataTemplate name="XXEMPDET" description="Employee Details" version="1.0"> <parameters></parameters> <lexicals></lexicals> <dataQuery> <sqlStatement name="Q1">

<![<span class="hiddenSpellError">CDATA</span>[select employee_number, full_name, '' email_address, pp.namefrom per_people_x 09 ppx, per_assignments_x pax, per_positions ppwhere pax.person_id = ppx.person_idand pax.position_id = pp.position_idand ppx.current_employee_flag = 'Y'and rownum < 5]]>

10 11 12 1 3 1 4 "/> 1 5 me"/> 16 17 18 19 20 /> </sqlStatement> </dataQuery> <dataStructure> <group name="G_EMP" dataType="VARCHAR2" source="Q1"> <element name="EmpNo" dataType="VARCHAR2" value="employee_number <element name="Employee_Name" dataType="VARCHAR2" value="full_na <element name="Email" dataType="VARCHAR2" value="email_address" <element name="Position" dataType="VARCHAR2" value="name"/> </group> </dataStructure> </dataTemplate> Create the concurrent program Concurrent program registration Register the data definition Responsibility: XML Publisher Administrator Navigation: Data Definition .

Register data definition Attach the concurrent program to the request group and execute the program to generate the XML output. Concurrent request .

Create the layout template Report layout template Attach the XML as Preview Data .The output shows the following.

Attach XML as Preview data Register the template Navigation: Templates Create a template .Responsibility: XML Publisher Administrator Navigation: Data Definition Query for Code = XXEMPDET Attach the XML generated from the program output to the Preview Data section of the data definition.

Execute the report to view the data XML report output There are 4 records for 4 employees in the report.0" encoding="UTF-8"?> 02 <xapi:requestset xmlns:xapi="http://xmlns. Create the bursting template The most important aspect of XML bursting is the bursting control file. We are displaying 2 employees for 01 <?xml version="1. This is a XML file which contains specific tags for bursting the XML output generated earlier.Register layout template Check Preview to see if the template matches with the" type="bursting"> 03 <xapi:globalData location="stream"> .

04 xapi:globalData > 05 06 <xapi:request select="/XXEMPDET/LIST_G_EMP/G_EMP"> <xapi:delivery> <xapi:email id="123" server="eymail.pdf" outputtype="pdf" delivery="123"> <xapi:template type="rtf" location="/tmp/XXEMPDET. if the email should contain an attachment  content-type or type of email  The mail body will be enclosed within thetags xapi:email xapi:message xapi:document This node contains the attachment document and XML template related tags and attributesThe attributes in this tag are rela the email attachment  Key or unique identifier of each attachment  Output or attachment file name  Output-type or attachment file type This node contains the template information like.local" reply-to="applprod@eyepdbe1.local"> <xapi:message id="123" to="${EMAIL}" attachment="true" content0 8 type="html/text" subject="Employee details for Empno ${EMPNO}"> 09 10 11 12 13 Regards.etihad.  To or the email address where the email should be sent  Subject or the email subject  attachment .HR team 14 xapi:message> 15 16 17 18 19 20 xapi:email> xapi:delivery> <xapi:document key="${EMPNO}" output="${EMPNO}.  server or the email server IP or name  port or the email server port  from or the email address from which the server should send the email  reply-to or the email address to which the replies should be sent This tag contains the attributes about the email like.rtf"> xapi:template> xapi:document> Please find your details attached. 21 xapi:request> 22 xapi:requestset> Explanation of the bursting template XML tag xapi:request select= xapi:delivery Explanation This tag in the control file indicates from which tag/node in the concurrent program output XML should separated for burs This node contains all email related attributes This tag contains the email attributes like.local" port="25" from="applpro 0 7 d@eyepdbe1.  Type or the file type of the template  Location or the directory of the template file along with the file name xapi:template .etihad.e. Dear ${EMPLOYEE_NAME}. i.etihad.

2. 3. 1. Attach the bursting file to the Data Definition of the XML Publisher Report Responsibility: XML Publisher Administrator Navigation: Data Defintions Upload the bursting control file Upload the bursting file in Bursting Control File section. Responsibility: XML Publisher Administrator Navigation: Administration tab . A temporary directory has to be provided for XML Publisher engine to use for bursting. Id attribute in xapi:email tag Id attribute in xapi:message tag Delivery attribute in xapi:document tag If the 3 values do not match then delivery will not take place as expected.The following attributes should contain the same values for bursting to function properly. Change the temporary directory location.

FTP the template FTP the layout file.e. Enter /tmp directory as the temporary directory. This directory can be any directory on which Oracle apps has write permissions. i. /tmp directory has write permissions for all users. .Set temporary directory In Unix. the XML layout template in the /tmp directory. as we have defined in the bursting control file that the template file location is /tmp XML layout template in /tmp directory XML Bursting execution process Run the XX Employee detail report to generate the output.

e. XML Publisher Report Bursting Program. This program is responsible for bursting the XML with the help of the bursting control file attached to the concurrent program whose output will be burst.Execute the report After the report is generated. Request ID: 19011719 . We shall select the 2 nd request from the top. i. XML Publisher Report Bursting Program Select the request of the previously run report’s request id. execute the program named. Ensure that this program is attached to the request group of this responsibility.

Concurrent request selected Execute the bursting program Bursting program executed When the bursting program ends. . the program name in the SRS form changes as shown below Bursting program name changed in SRS form Now check the output of the bursting program.

Email body . Remember that we had set the email address of all the 4 employees to a single email address for this demonstration within the report query itself. You can check the data template for the query at the top. We shall check the mailbox now. Emails sent by bursting program Each mail body looks like the following.Bursting program output The bursting program output shows that 4 emails were delivered.

03 IS 04 v_req_id 05 BEGIN 06 -. argument3 => 'Y' --CHR(0). XML Publisher Report Bursting Program. argument1 => 'Y'. attachment name and attachment file type match with the bursting control file above.Call Bursting Program 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 IF v_req_id = 0 THEN srw. . 01 FUNCTION afterreport 02 RETURN BOOLEAN NUMBER.The email body. description start_time sub_request => ''. The attachment will contain the data from the XX Employee detail report.MESSAGE (123. argument2 => :p_conc_request_id. program => 'XDOBURSTREP'.submit_request (application => 'XDO'. Automatic execution of XML Publisher Report Bursting Program Since the bursting program. Attachment The bursting process is now complete. => FALSE. The bursting program can be executed automatically if we use a rdf report to generate the data for the XML publisher report.'). --'' ). 'Failed to call bursting program. has to be run manually this might not be feasible for all users to use. v_req_id := fnd_request. => ''. In a rdf report we can add the following piece of code in the After Report trigger in the report to execute the bursting program as soon as the output has been generated by the report.

[3/22/12 2:19:05 PM] [320381:RT19011722] Completed post-processing actions for request 19011722.common.DelegatingMethodAccessorImpl.xdo. The log file will talk about checking the Output Post processor logs. 03 05 [3/22/12 2:33:10 PM] [320381:RT19011756] 06 Template code: BURST_STATUS_REPORT 07 Template app: XDO 08 Language: en 09 Territory: 10 Output type: 11 US RTF [3/22/12 2:33:10 PM] [UNEXPECTED] [320381:RT19011756] java.reflect.XSLT10gR1.invoke0(Native Method) at 13 sun.transform(XSLTWrapper.NativeMethodAccessorImpl.invoke(Method.Method.23 24 25 26 END IF.xml. 27 END.apps.xml. RETURN (TRUE).lang. [3/22/12 2:33:10 PM] [OPPServiceThread0] Post-processing request 02 at oracle.XSLTWrapper.xml.NativeMethodAccessorImpl.invoke(DelegatingMethodAccessor 4 Impl.lang.invokeParse(XSLT10gR1.xdo.reflect.apps. Bursting program log After checking the Output Post Processor logs we get the following. [3/22/12 2:33:10 PM] [320381:RT19011756] Starting XML Publisher post04 processing at 18 oracle.jav a:39) at 1 sun.invoke(NativeMethodAccessorImpl.apps.XSLT10gR1.transform(XSLT10gR1. Bursting program error The XML Publisher Bursting program might error at 16 oracle. 15 at java. I have described how to get the Output Post Processor logs in a previous article.reflect.common. 01 [3/22/12 2:33:10 PM] [320381:RT19011756] Executing post-processing actions for request 19011756.InvocationTargetException 12 at 17 .reflect.USER_EXIT ('FND SRWEXIT').

java:5926) at 2 34 at oracle.sax.util.generateFO(FOUtility.createFO(FOProcessor.parser.template.FOUtility.apps.parser.XMLError.flushErrorHandler( at 3 2 at 3 Caused by: org.FOUtility.rtf"> .java:104 9 4) at 2 oracle.FOProcessor.process(XMLPublisherProcess 7 or.apps.processTemplate(TemplateH 6 elper.parseDocument(NonValidatingPars 3 er.SAXParseException: <Line 1.fnd.v2.OPPRequestThread.xdo.generate( at 2 17 more The location specified as the XML layout template directory should be valid and all permissions must be available on this file as well as the directory.generateFO(FOUtility.parse( 1 at 2 35 36 [3/22/12 2:33:10 PM] [320381:RT19011756] Completed post-processing actions for request 19011756. This error relates to the template in the 29 3 1 at Column 1>: XML-20108: (Fatal Error) Start of root element 1 ) 2 at 2 at 2 oracle.parser.apps.XMLError.TemplateHelper.XMLParser.util.server.parser.apps.fnd.server.xdo.NonValidatingParser.xdo. Check the setting in the bursting control file.flushErrors1(XMLError.processTemplate(TemplateH 5 elper.v2.v2.schema.xdo.xdo.xdo. It means that XML 38 processor is unable to find the template.v2. Related articles .java:303) at 3 at 28 oracle.oa.generateFO( 0 ) at 2 oracle.schema.runProcessTemplate(Templa 4 teHelper. 37 39 <xapi:template type="rtf" location="/tmp/XXEMPDET. at 30 oracle.apps.parseRootElement(NonValidatingPa 2 rser.

com) Inbound transaction using XML Gateway ( Email concurrent program output using Printer Styles ( .   Oracle Advanced Queue (AQ) demo (oraclemaniac.