Vous êtes sur la page 1sur 25

XML Bursting

Bursting (Email report output) in XML Publisher reports


XML Bursting is a feature available in Oracle bywhich a XML is exploded into diferentparts based on a
defined logic and the individualparts are again converted into reports based on a layoutand sentvia em
ailto designated m ailboxes.
This is a veryhelpfulfeature especialyifyou are trying to send the outputofa reportto an em ailaddress orm
ultiple em ailaddress
Benefits ofXML bursting
1. The feature is standard forXML Publisherversion 5.6.3
2. No coding is required
3. Outputis sentvia em ail.Userdoes notneed to login to Oracle to getthe report
4. The m ain reporttem plate and the bursting tem plates can be diferentfrom each other.Thus there can
be one outputfrom the concurrentprogram and a diferentlayoutto send as em ail.

Dem onstration ofXML bursting


W e created a XML Publisherreportwith using a data tem plate.The reporthas been developed to return 4
records.W e shaluse bursting to send the 4 records as 4 diferentreports to 4 em ailaddresses.For
ourexam ple we have used 1 em ailaddress across al4.

XML Data Tem plate


The data tem plate is given below,
1 span class="hiddenSpellError">xml</span> version="1.0" encoding="ISO-8859-1"?> 2

3
4
5
6
7
8
9
10
11
12
13
14
15

<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, 'eyaray@etihad.a
</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_name"/>

16
17

<element name="Email" dataType="VARCHAR2" value="email_address"/>


<element name="Position" dataType="VARCHAR2" value="name"/>
1/14

12/4/13

</group>
18
19
20

</dataStructure>
</dataTemplate>

Create the concurrentprogram

Concurrentprogram registration

Registerthe data definition


Responsibility:XML PublisherAdm inistrator
Navigation:Data Definition

2/14

12/4/13

Oracle Apps Consultant: XML Bursting

Registerdata definition

Atach the concurrentprogram to the requestgroup and execute the program to generate the XML output.

Concurrentrequest

The outputshows the folowing,

----

3/14

12/4/13

Oracle Apps Consultant: XML Bursting

Create the layouttem plate

Reportlayouttemplate

Attach the XML as Preview Data


Responsibility:XML PublisherAdm inistrator
Navigation:Data Definition
QueryforCode = XXEMPDET
Atach the XML generated from the program outputto the Preview Data section ofthe data definition.

----

4/14

12/4/13

Oracle Apps Consultant: XML Bursting

Attach XML as Preview data

Registerthe tem plate


Navigation:Tem plates
Create a tem plate

Registerlayouttemplate

CheckPreview to see ifthe tem plate m atches with the XML.

Execute the reportto view the data

----

5/14

12/4/13

Oracle Apps Consultant: XML Bursting

XML reportoutput

There are 4 records for4 em ployees in the report.W e are displaying 2 em ployees forease.
Create the bursting tem plate
The m ostim portantaspectofXML bursting is the bursting controlfile.This is a XML file which contains
specifictags forbursting the XML outputgenerated earlier.
1 xml version="1.0" encoding="UTF-8"?>
<xapi:requestset xmlns:xapi= "http://xmlns.oracle.com/oxp/xapi" type="bursting">
3

<xapi:globalData location="stream">

4 xapi:globalData >
5

<xapi:request select="/XXEMPDET/LIST_G_EMP/G_EMP">

<xapi:delivery>

<xapi:email id="123" server="eymail.etihad.local" port="25" from="applprod@eyepdbe1.etihad.local"

<xapi:message id="123" to="${EMAIL}" attachment="true" content-type="html/text" subject="Employee

9
10
11
12

Dear ${EMPLOYEE_NAME},
Please find your details attached.
Regards,HR team

13 xapi:message>
14

xapi:email>

15

xapi:delivery>

16

<xapi:document key="${EMPNO}" output="${EMPNO}.pdf" output-type="pdf" delivery="123">

17

<xapi:template type="rtf" location="/tmp/XXEMPDET.rtf">

18

xapi:template>

19

xapi:document>

20 xapi:request>
21 xapi:requestset>
22

----

6/14

12/4/13

Oracle Apps Consultant: XML Bursting

Explanation ofthe bursting tem plate


XML tag

Explanation

xapi:requestselect=

This tag in the controlfile indicates from which tag/node in the concurrentprogram outputXML should
separated forbursting

xapi:delivery

This node contains alem ailrelated atributes


This tag contains the em ailatributes like,
serverorthe em ailserverIP ornam e
portorthe em ailserverport
from orthe em ailaddress from which the servershould send the em ail
reply-to orthe em ailaddress to which the replies should be sent

xapi:em ail

This tag contains the atributes aboutthe em aillike,


To orthe em ailaddress where the em ailshould be sent
Subjectorthe em ailsubject
attachm ent,i.e.ifthe em ailshould contain an atachm ent
content-type ortype ofem ail
The m ailbodywilbe enclosed within thetags

xapi:m essage

This node contains the atachm entdocum entand XML tem plate related tags and atributesThe
atributes in this tag are related to the em ailatachm ent
xapi:docum ent

Keyorunique identifierofeach atachm ent


Outputoratachm entfile nam e
Output-type oratachm entfile type
This node contains the tem plate inform ation like,

xapi:tem plate

Type orthe file type ofthe tem plate


Location orthe directoryofthe tem plate file along with the file nam e

The folowing atributesshould contain the sam e valuesforbursting to function properly,


1.

Id atribute in xapi:emailtag

2.

Id atribute in xapi:message tag

3.

Delivery atribute in xapi:documenttag

Ifthe 3 valuesdo notm atch then deliverywilnottake place asexpected.

Attach the bursting file to the Data Definition ofthe XML PublisherReport
Responsibility:XML PublisherAdm inistrator
Navigation:Data Defintions

----

7/14

12/4/13

Oracle Apps Consultant: XML Bursting

Upload the bursting controlfile

Upload the bursting file in Bursting ControlFile section.

Change the tem porarydirectorylocation.


A tem porarydirectoryhas to be provided forXML Publisherengine to use forbursting.
Responsibility:XML PublisherAdm inistrator
Navigation:Adm inistration tab

----

8/14

12/4/13

Oracle Apps Consultant: XML Bursting


Settemporary directory

In Unix,/tm p directoryhas write perm issions foralusers.Enter/tm p directoryas the tem porarydirectory.
This directorycan be anydirectoryon which Oracle apps has write perm issions.

FTP the tem plate


FTP the layoutfile,i.e.the XML layouttem plate in the /tm p directory,as we have defined in the bursting
controlfile thatthe tem plate file location is /tm p

XML layouttemplate in /tmp directory

XML Bursting execution process


Run the XX Em ployee detailreportto generate the output.

Execute the report

After the report is generated, execute the program nam ed, XML Publisher Report Bursting
Program .This program is responsible forbursting the XML with the help ofthe bursting controlfile
atached to the concurrentprogram whose outputwilbe burst.Ensure thatthisprogram isatached to
the requestgroup ofthisresponsibility.

----

9/14

12/4/13

Oracle Apps Consultant: XML Bursting

XML PublisherReportBursting Program


nd

Selectthe requestofthe previouslyrun reports requestid.W e shalselectthe 2


i.e.RequestID:19011719

Concurrentrequestselected

Execute the bursting program

Bursting program executed

requestfrom the top,

----

10/14

12/4/13

Oracle Apps Consultant: XML Bursting

W hen the bursting program ends,the program nam e in the SRS form changes as shown below

Bursting program name changed in SRS form

Now checkthe outputofthe bursting program .

Bursting program output

The bursting program outputshows that4 em ails were delivered.


W e shalcheckthe m ailboxnow.Rem em berthatwe had setthe em ailaddress ofalthe 4 em ployees to a
single em ailaddress forthis dem onstration within the reportquery itself.You can check the data tem plate
forthe queryatthe top.

Emails sentby bursting program

Each m ailbodylooks like the folowing,

----

11/14

12/4/13

Oracle Apps Consultant: XML Bursting

Emailbody

The em ailbody,atachm entnam e and atachm entfile type m atch with the bursting controlfile above.The
atachm entwilcontain the data from the XX Em ployee detailreport,

Attachment

The bursting process is now com plete.


Autom atic execution ofXML PublisherReportBursting Program
Since the bursting program ,XML PublisherReportBursting Program ,has to be run m anualythis m ight
notbe feasible foralusers to use.The bursting program can be executed autom aticaly ifwe use a
rdfreportto generate the data forthe XML publisherreport.In a rdfreportwe can add the folowing piece
ofcode in the AfterReporttriggerin the reportto execute the bursting program as soon as the outputhas
been generated bythe report.
1 FUNCTION afterreport
2

RETURN
BOOLEAN

3 IS
4

v_req_id

NUMBER;

5 BEGIN
6

-- Call Bursting Program

v_req_id :=

fnd_request.submit_request (application => 'XDO',

program => 'XDOBURSTREP',

10

description

=> '',

---12/14
12/4/13

Oracle Apps Consultant: XML Bursting

11

start_time

12

sub_request

13

argument1 => 'Y',

14

argument2 => :p_conc_request_id,

15

argument3 => 'Y'

16

--CHR(0),

17

--''

18

);

19

THEN

21

srw.MESSAGE (123, 'Failed to call bursting program.');

22

END IF;

23

25
26

=> FALSE,

IF v_req_id = 0

20

24

=> '',

srw.USER_EXIT ('FND SRWEXIT');


RETURN (TRUE);
END;

27

Bursting program error


The XML PublisherBursting program m ighterrorout.The log file
wiltalkaboutchecking the OutputPost processorlogs.Ihave described how to
getthe OutputPostProcessorlogs in a previous article.

Bursting program log

Afterchecking the OutputPostProcessorlogs we getthe folowing,


1
[3/22/12 2:19:05 PM] [320381:RT19011722] Completed post-processing actions for request
19011722.

2 [3/22/12 2:33:10 PM] [OPPServiceThread0] Post-processing request 19011756.


3 [3/22/12 2:33:10 PM] [320381:RT19011756] Executing post-processing actions for request 19011756.
4 [3/22/12 2:33:10 PM] [320381:RT19011756] Starting XML Publisher post-processing action.
5 [3/22/12 2:33:10 PM] [320381:RT19011756]
6 Template code: BURST_STATUS_REPORT

7 Template app: XDO


8 Language:

en

9 Territory:

US

10 Output type:

---13/14

RTF

12/4/13

11

Oracle Apps Consultant: XML Bursting

[3/22/12 2:33:10 PM] [UNEXPECTED] [320381:RT19011756] java.lang.reflect.InvocationTargetException

12

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

13

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

14

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

15

at java.lang.reflect.Method.invoke(Method.java:597)

16

at oracle.apps.xdo.common.xml.XSLT10gR1.invokeParse(XSLT10gR1.java:566)

17

at oracle.apps.xdo.common.xml.XSLT10gR1.transform(XSLT10gR1.java:231)

18

at oracle.apps.xdo.common.xml.XSLTWrapper.transform(XSLTWrapper.java:182)

19

at oracle.apps.xdo.template.fo.util.FOUtility.generateFO(FOUtility.java:1044)

20

at oracle.apps.xdo.template.fo.util.FOUtility.generateFO(FOUtility.java:997)

21

at oracle.apps.xdo.template.fo.util.FOUtility.generateFO(FOUtility.java:212)

22

at oracle.apps.xdo.template.FOProcessor.createFO(FOProcessor.java:1665)

23

at oracle.apps.xdo.template.FOProcessor.generate(FOProcessor.java:975)

24

at oracle.apps.xdo.oa.schema.server.TemplateHelper.runProcessTemplate(TemplateHelper.java:5926)

25

at oracle.apps.xdo.oa.schema.server.TemplateHelper.processTemplate(TemplateHelper.java:3458)

26

at oracle.apps.xdo.oa.schema.server.TemplateHelper.processTemplate(TemplateHelper.java:3547)

27

at oracle.apps.fnd.cp.opp.XMLPublisherProcessor.process(XMLPublisherProcessor.java:290)

28

at oracle.apps.fnd.cp.opp.OPPRequestThread.run(OPPRequestThread.java:157)

29

Caused by: org.xml.sax.SAXParseException: : XML-20108: (Fatal Error) Start of root element expected.

30

at oracle.xdo.parser.v2.XMLError.flushErrorHandler(XMLError.java:441)

31

at oracle.xdo.parser.v2.XMLError.flushErrors1(XMLError.java:303)

32

at oracle.xdo.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:343)

33

at oracle.xdo.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:285)

34

at oracle.xdo.parser.v2.XMLParser.parse(XMLParser.java:289)

35

... 17 more

36
37
38

[3/22/12 2:33:10 PM] [320381:RT19011756] Completed post-processing actions for request 19011756.
This error relates to the template in the server. It means that XML processor is unable to find the

39

The location specified as the XML layouttem plate directoryshould be valid and alperm issions m ustbe
available on this file as welas the directory.

----

14/14

Vous aimerez peut-être aussi