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
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.
This tag in the control file indicates from which tag/node in the concurrent program output XML should separated for bursting
This node contains all email related attributes
This tag contains the email attributes like,
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,
To or the email address where the email should be sent
Subject or the email subject
attachment , i.e. if the email should contain an attachment
content-type or type of email
The mail body will be enclosed within thetags
This node contains the attachment document and XML template related tags and attributesThe attributes in this tag are related to 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,
Type or the file type of the template
Location or the directory of the template file along with the file name
The following attributes should contain the same values for bursting to function properly,
1. Id attribute in xapi:email tag
2. Id attribute in xapi:message tag
3. Delivery attribute in xapi:document tag
If the 3 values do not match then delivery will not take place as expected.
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.
Change the temporary directory location.
A temporary directory has to be provided for XML Publisher engine to use for bursting.
Responsibility: XML Publisher Administrator
Navigation: Administration tab
Set temporary directory
In Unix, /tmp directory has write permissions for all users. Enter /tmp directory as the temporary directory. This directory can be any directory on which Oracle apps has write permissions.
FTP the template
FTP the layout file, i.e. 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.
Execute the report
After the report is generated, execute the program named, 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. Ensure that this program is attached to the request group of this responsibility.
XML Publisher Report Bursting Program
Select the request of the previously run report’s request id. We shall select the 2nd request from the top, i.e. Request ID: 19011719
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.
Bursting program output
The bursting program output shows that 4 emails were delivered.
We shall check the mailbox now. 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.
Emails sent by bursting program
Each mail body looks like the following,
The email body, attachment name and attachment file type match with the bursting control file above. The attachment will contain the data from the XX Employee detail report,
The bursting process is now complete.
Automatic execution of XML Publisher Report Bursting Program
Since the bursting program, XML Publisher Report Bursting Program, has to be run manually this might not be feasible for all users to use. The bursting program can be executed automatically if we use a rdf report to generate the data for the XML publisher report. 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.
-- Call Bursting Program
fnd_request.submit_request (application => 'XDO',
program => 'XDOBURSTREP',
description => '',
start_time => '',
sub_request => FALSE,
argument1 => 'Y',
argument2 => :p_conc_request_id,
argument3 => 'Y'
IF v_req_id = 0
srw.MESSAGE (123, 'Failed to call bursting program.');
srw.USER_EXIT ('FND SRWEXIT');
Bursting program error
The XML Publisher Bursting program might error out. The log file will talk about checking the Output Post processor logs. I have described how to get the Output Post Processor logs in a previous article.
Bursting program log
After checking the Output Post Processor logs we get the following,
[3/22/12 2:19:05 PM] [320381:RT19011722] Completed post-processing actions for request 19011722.