Sunday, February 22, 2015

10.XML Bursting to Send XML Report via Email

Oracle Bursting Mechanism enables us to deliver a single XML Publisher report/letter to multiple destinations simultaneously.One can create a single report/letter , then send it in any format (e.g., PDF or HTML) to multiple destinations(email ids).
There are two kind of bursting mechanism available within BI publisher
1) Control File Base:- Integrated with EBS
2) Delivery SQL based:- Part of Enterprise release.All delivery, template, output format, locale and other details define through delivery SQL Query. Enterprise Edition assume that this information is stored in data base. The process create the XML file out if this query and the delivery xml file works as control file.
 
Here we will discuss about the "Control File Base" mechanism.
 
Basic Requirement
 Our basic requirement is to send grade change(promotion) letter to the supervisor of the employee.This needs to be achieved using XML Publisher Bursting Mechanism.
 
Pre-Requisite
Following are the pre-requisites for report to build and also for applicability of solution
  • We are creating the template using MS word Form Field method.
Solution Approach
To achieve this we will first understand the different aspects and terminology used in XML Publisher
 
 
Data Definition
The data definition is registration the source of the data that will be merged with template layout to create published report/letter.
Navigation:- XML Publisher Administrator àData DefinitionsàClick on Create Data Definition
 
 

Bursting Control File
Bursting control file is a XML file that contains following information
Control file is xml file (.xml) and contains information such as
  • Level in XML data that you wish to burst on.
  • Email address From, To, subject etc
  • Message we want to send
  • Busted file type (PDF/Excel/HTML etc…), file name, Filter Conditions etc...
  • Location of Template which will be used to generate output busted file.
 
Now to understand the bursting control file we will take an example of our sample XML data file(that will be created via pl/sql procedure)
 
 
 
There are restriction while creating bursting control file
a) The server ip address and port can not be dynamic. It must be hard coded in the file.
b) To define the location follow the following steps
<xapi:template type="rtf" location="/ora_shared/R12/DBXX/apps/apps_st/comn/temp/Test.rtf" /> ##
Navigation:- XML Publisher Administrator àAdministration
Go to Propertiesà Temporary Directory and copy the location that location will be location of our rtf template
 
##=> Sometime the above mentioned process may give you bursting error while running concurrent program, then use the alternative method mentioned below.
 
 
Alternatively the following can be used
location="xdo:///?getSource=true"
:-
selectlt.application_short_name || '.' || lt.template_code || '.' || lt.default_language || '.' || lt.default_territory asburst_template_xdo_location
fromapps.xdo_templates_b ltwhere lt.template_code ='--here value
 
Now Search for the newly created Data Definition and click on the hyperlink the search results.Now attach the Bursting control file with the data definition.
Navigation:- XML Publisher Administrator àData DefinitionsàSearch for newly Created Data Definition
 
 
 
Template
Rich Text Format (RTF) is a specification used by common word processing applications, such as Microsoft Word.XML Publisher’s RTF Template Parser converts documents saved as the RTF file type to XSL-FO.Therefore we can create report designs using your standard word processing application’s design features and XML Publisher will recognize and maintain the design.
 
Now create a RTF using basic Form Field Method(Using Microsoft Word’s form field feature).
 
 
 
 
once the rtf is created, save it local. Now create a data template(follow the navigation mentioned above).
 
 
 
 
 
Note:-Now take the temp location path(noted while discussing Bursting Control file) and put your rtf file also in that location.
 
 
Concurrent Program
Define the concurrent program. The concurrent program used in XML publisher report has following restrictions.
1) The concurrent Short name must match with the short name of the data definition
2) The Output format of the concurrent program will be "XML"
 
 
 
Concurrent Executable Package
We need to create a database package that will generate the XML data file which will be used to feed the data in temaplate and generate letter.
Here our code will retrive the all the employee under a particular supervisor and send it to him with the grade information letter.
 
  
  Now write the cursor that will retrieve all the employee having valid grade for a particular supervisor(person_id came as input)
 
 
Now our cursors are ready, we have to create xml and need to write in the ourput of the concurrent program.
Please refer your designed xml based on which the bursting was designed and repeat/close any element as shown the pic below.
 
 
Once the xml is prepared , then we need to call the seeded bursting program,so that the generated letter can reach to supervisor
 
 
 
 
Now compile the package and run the concurrent program.
 
Note:- 1) As we mentioned earlier the bursting will happen from /ListOfEmpDtls/EmpDtls.
             create your xml accordingly.
 
    2) To write it log of the concurrent program use the following fnd utility
     LOG file writing:-
          FND_FILE.PUT_LINE(FND_FILE.LOG, 'ABCD in Log File');
     OUTPUT file writing:-
        FND_FILE.PUT_LINE(FND_FILE.OUTPUT, 'ABCD in Out File');
 
   3) Bursting program may goes into error, in that case will suggest you to raise a SR with Oracle.
   4) Sample rtf file,code,bursting control file is attached for reference
 

No comments: