Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

XML Reports With Screen Shots Jainullabuddin B

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 71
At a glance
Powered by AI
The key takeaways are that XML Publisher is a template-based publishing solution that separates data from presentation and allows generating reports in multiple formats like PDF, Excel, etc. It discusses how to create XML reports and templates.

The main features of XML Publisher discussed are that it separates data source from presentation, enables designing templates using MS Word or Adobe Acrobat, and allows generating output in flexible formats.

Benefits of XML Publisher discussed are simplicity of usage, reusability, language translations, standard image inclusion, flexibility, reduced maintenance and lesser costs.

XML REPORTS

XML REPORTS
With Screen shots

Jainullabuddin B

Jainullabuddin B Page 1
XML REPORTS

INDEX

TITLE
INTRODUCTION
VERSION OF XML
CREATING AN ORDINARY XML
REPORT
INSERTING INDIVIDUAL FIELDS
GETTING TWO KIND OF OUTPUT
AT A TIME
RTF TEMPLATE
CREATING XML REPORT USING
PROCEDURES

ERRORS FACED
SUMMARY

Jainullabuddin B Page 2
XML REPORTS
INTRODUCTION
Oracle XML Publisher is a template-based publishing solution delivered with the Oracle
E- Business Suite. XML Publisher is a tool which enables the users to produce
• Flexible
• High Quality
• Template-Based Reports
The main feature of XML Publisher is that it separates the Data Source from the
presentation/Layout

Data
Logic
Layout
XML
Report
Translation Publisher
output
n
• XML Publisher enables user to design the check layout using Microsoft word or
Adobe Acrobat

One Template – Multiple Outputs


XML Data

PDF

HTML

XML Publisher

EXCEL

RTF

RTF Templates are converted to XSL-FO, then


formatted to multiple outputs

BENEFITS OF XML PUBLISHER

Jainullabuddin B Page 3
XML REPORTS
• Simplicity of Usage : It reduces the coding effort as the final output generation is
handled by XML Publisher. The developer has to concentrate only on developing the
report logic
• Reusability : Single code can be used to generate output in Excel/PDF/RTF and other
formats.
• Language Translations
• Standard Image Inclusion : Images or logos can be embedded while template creation,
reference can also be made directly to gif/jpg images
• Flexibility
• Reduced Maintenance
• Less labor intensive
• Lesser Costs

VERSION OF XML
Version 5.6 Build 45

Another way to find the Version


PDF Output : open the file in Adobe Acrobat
-> menu File
-> Document Properties
-> tab Description
-> property ‘PDF Producer’ will show

Jainullabuddin B Page 4
XML REPORTS

1.CREATING AN ORDINARY XML REPORT


Create a Report using a Query in .rdf format.
STEP1: Open the Report Builder and Select the option to build the report manually.
The Query used is to bring the items created after 01-Jan-2008

SELECT inventory_item_id, segment1, description, creation_date
  FROM mtl_system_items_b
 WHERE creation_date > TO_DATE ('01-JAN-2008') AND organization_id = 204

Connect as apps/apps@prod
Create the Layout. [Actually, there is no need to create layout for XML report. Here, we have
created it for demo purpose.]
The Output will be like this.

Jainullabuddin B Page 5
XML REPORTS

Save this Report in the Inventory Top.

This is saved as
D:\oracle\prodappl\inv\11.5.0\reports\US\xinv.RDF

STEP2: Generate XML File

Jainullabuddin B Page 6
XML REPORTS
It will ask the location to save. It is saved as E:\Selvam\Selvam P.S\Materials\XML\XML
Tutorial – Selvam\ xinv.xml

This is the XML coding for the RDF File.

STEP 3: CREATE XML TEMPLATE


Now, we have to create a template for Output. For this open Microsoft word.

If XML was installed in Your system, You can see this.

Now Load the XML data.

Jainullabuddin B Page 7
XML REPORTS

Jainullabuddin B Page 8
XML REPORTS

You will get the result as

Create the Template.

Here, we are inserting all those fields. So, Select All Fields.
You will get the layout as Follows

This is the Template, we have created. Save this as rtf file [Rich Text Format].
E:\Selvam\Selvam P.S\Materials\XML\XML Tutorial – Selvam\xtemplate1.rtf.
You can see the preview here.

The output is in .pdf format because, we have selected the pdf format.

Jainullabuddin B Page 9
XML REPORTS

STEP4: REGISTER THE REPORT IN APPS

Open the Application.


Goto System Administrator Responsibility. Create the Executable

Jainullabuddin B Page 10
XML REPORTS

Save it. Create the Concurrent Program

Jainullabuddin B Page 11
XML REPORTS

Save it.
Now, we have to find the Request Group Name.

Query for Inventory, Vision Operations (USA)

Jainullabuddin B Page 12
XML REPORTS

Now, Add this Report to the Inventory request Group.

Query for Your Request group and Add the New Program.

Jainullabuddin B Page 13
XML REPORTS

Save It.
Go to Inventory Responsibility.

Run the Program

You will get the result in the XML Format.

Jainullabuddin B Page 14
XML REPORTS

But this is not the format, we require. This was generated, because, we have not attached the
template (Which we created) anywhere.

STEP5 : ATTACHING THE TEMPLATE


Now GO to XML Publisher Administrator responsibility

Jainullabuddin B Page 15
XML REPORTS
If You don’t have the XML Publisher Admin responsibility, Add it. This is explained in a
separate sheet.
E:\Selvam\Selvam P.S\Materials\Screen Shots\Selvam\Adding responsibility to a User.doc

Creating the Data De nition


When you create the data definition, you register the source of the data that will be merged with
your template layout to create your published report.

We have to create the Data Definition Now.

By Default, it will be in the query mode. So Click CREATE DDF

Jainullabuddin B Page 16
XML REPORTS

One Important thing here is, Give the Code name same as the Conc Prgm Short Name in caps.
Else it will not give the result.
If you are using the Oracle Applications concurrent manager to generate your report, the
data definition Code must match the concurrent program short name of the report program (for
example, RAXCUS for the Customer Listing Summary). This enables the concurrent manager to
locate the templates available for the report concurrent program when you submit the request.
After the data definition is created, all the fields are updateable except Application
and Code

Creating the Template


When you create a template, you assign it a data definition and upload your template
layout files. Assigning the data definition makes the template available to the corresponding data
source at runtime.

Now Attach the Template,

Jainullabuddin B Page 17
XML REPORTS

After the template definition is created, the following fields are not updateable: Application,
Code, and Type

Now, you Run the Report in the Inventory Responsibility

Jainullabuddin B Page 18
XML REPORTS

If You see the output, it will come in the Format we have give. Here we have given as PDF

This is the Simple way of creating the XML Report.

POINTS TO REMEMBER

Jainullabuddin B Page 19
XML REPORTS
• If You have modified anything in the template, then update it in XML
Template. Use Update button and Browse Button. Else it will work in the
previously registered template only.

If You Click Download Button,

The corresponding RTF file will be opened

2. INSERTING INDIVIDUAL FIELDS


In the Previous Example, we have inserted all the field directly, by Giving Insert
 All Fields

In this situation, All the fields will be inserted directly. If we require some selected fields only,
we can do it.
For this, we have to do some modifications in the template. Here, we create a new template.

• Open a word document. Load the Data as told before


• Draw a Layout by using Insert Table.

After drawing table, Type the Following things and keep ready the template.

Jainullabuddin B Page 20
XML REPORTS

This is just a skeleton, we have to insert the fields now.

You will get the options now

Now, Insert as per Your requirements

Jainullabuddin B Page 21
XML REPORTS

After inserting all those, Save the File in rtf format. E:\Selvam\Selvam P.S\Materials\XML\XML
Tutorial – Selvam\xtemplate2.rtf
You can see the Preview now.

You will get only one row in this report. Because, we have nowhere specified to repeat for the
next lines. For that we have to write one tag.
You can see the tag in the automatically created tag.

We have to write it manually now. If You double-click it, You can see the tag.

Jainullabuddin B Page 22
XML REPORTS

You will see the tag now

For End Group,

Jainullabuddin B Page 23
XML REPORTS

Now Insert these codes in the newly created templates.

You can see the preview now.

Jainullabuddin B Page 24
XML REPORTS

You can test it by running in the Apps Also.

For this You have to make changes in the XML Publisher Templates only. You can create a new
template also.

You can see that two templates are attached

Jainullabuddin B Page 25
XML REPORTS

Now Run the report in APPS.

You can see that the Old template was added here. If, You need to change this one,

Jainullabuddin B Page 26
XML REPORTS

Don’t Forget to Give OK.


Now, Give Submit.
If You give the Output,

Jainullabuddin B Page 27
XML REPORTS

The Output was got in the HTML Format.

3. GETTING TWO KIND OF OUTPUT AT A TIME


The Unique feature of XML Report is to get two kind of reports at a time. For this, we have to do
a minor Modification.
Here, Let us imagine that there is a situation to get both the templates at a time. [Manager1 is
asking a report in PDF format and Manager2 is asking a report in Excel format].

While Submitting a report, You can see the Layout field having only one option. Our requirement
is adding two templates here. So, Go to Options,

Jainullabuddin B Page 28
XML REPORTS

Add Your New template and Save. You can’t see any Save Option here. So, Just Press CTRL+S.

{Here, XML Format is not working. SO I have changed it to HTML Format}

Jainullabuddin B Page 29
XML REPORTS

Then press OK.


You can see that two templates are added here.

Now, Submit the Request, You will get two results.


Two Requests will be submitted at a time.

You can see the results in two separate sheets.

POINTS TO REMEMBER

Jainullabuddin B Page 30
XML REPORTS
Whenever You are submitting the request, The Template You have very first defined will
come as default one. If You need to change it,

Jainullabuddin B Page 31
XML REPORTS

It will take the second template. You can check this in VIEW DETAILS

Jainullabuddin B Page 32
XML REPORTS

If You give CTRL + S Here, You will get two templates


RTF TEMPLATE
Rich Text Format (RTF) is a specification used by common word processing
applications, such as Microsoft Word.
The RTF layout can be designed using the Standard features in Word.
 Select the size, font, and alignment of text
 Insert bullets and numbering
 Draw borders around paragraphs
 Include a watermark
 Include images (jpg, gif,)
 Use table auto formatting features
 Insert a header and footer

Creating Placeholders
The placeholder maps the template field to the XML element data field. At runtime the
placeholder is replaced by the value of the element of the same name in the XML data file.

Enter placeholders in your document using the following syntax:


<?XML element tag name?>

You can use the XML template without using the insert option in Template Builder. For this, we
have to write the tags.

Jainullabuddin B Page 33
XML REPORTS
Let us create a new template with the same XML data. But Only two columns in it.
• Open a new word document and save it as E:\Selvam\Selvam
P.S\Materials\XML\XML Tutorial – Selvam\xtemplate3.rtf
• Load the XML data into it
• Create a table having two columns in it. Give the column Headings.

Now Write the tag to insert the item

Be Sure that the Field Names are given in upper-case. Else it will not give the result.
If You see the Preview, You can see the result a single row.

De ning Groups

If, You need to have all the rows. Follow these steps
By defining a group, you are notifying XML Publisher that for each occurrence of an
element, you want the included fields displayed. At runtime, XML Publisher will loop through
the occurrences of the element and display the fields each time.
Insert the following tag before the first element:
<?for-each:XML group element tag name?>
Insert the following tag after the final element:
<?end for-each?>

Let us write this in our Query.

Jainullabuddin B Page 34
XML REPORTS

Ensure that it don’t have any spaces in it. If You give any space in Your tag, the following error
will occur.

Because, we have left a space here.

Note that the group element must be a parent of the repeating elements in the XML input file.

If You want this Group tag is to be displayed as in the automatically created one. i.e F
For this, we have to enable the following

Jainullabuddin B Page 35
XML REPORTS

Keep the cursor in the place we have to insert the tag,

Jainullabuddin B Page 36
XML REPORTS
Double click in it. You will get like this.

Type Your tag and close.

You can see the output

Headers and Footers.


Use the following tags to enclose the body area of your report:
<?start:body?>
<?end body?>

Jainullabuddin B Page 37
XML REPORTS
Create a New Template with Header . E:\Selvam\Selvam P.S\Materials\XML\XML Tutorial –
Selvam\ xtemplate4.rtf

We have specified “Sample Header” as the Header here. Let us check whether the Header is
coming.

In the same manner, do for footers also.

Jainullabuddin B Page 38
XML REPORTS

This header can be mingled with the ordinary header and Footer Also.
Let us Add the ordinary Header

You can see this header with the previous header also.

Jainullabuddin B Page 39
XML REPORTS
If You see the output, both will appear.

Background and Watermark Support


XML Publisher supports the "Background" feature in Microsoft Word. You can specify a single,
graduated color or an image background for your template to be displayed in the PDF output.
Note that this feature is supported for PDF output only.
To add a background to your template, use the Format > Background menu option.

This is as usual in the Word.

Jainullabuddin B Page 40
XML REPORTS
Page Breaks
• To create a page break after the occurrence of a specific element

• To insert a page break between each occurrence of a group, insert the "split-
by-page-break" form field within the group immediately before the <?end
for-each?> tag that closes the group

IN Our Example,

Then You will see the result, in separate Page

Jainullabuddin B Page 41
XML REPORTS

SORTING
Let us use a new template for this purpose. This is saved as E:\Selvam\Selvam
P.S\Materials\XML\XML Tutorial – Selvam\xtemplate7.rtf.
The template is normal template with insertion of all the fields into it.

This have the output as

Jainullabuddin B Page 42
XML REPORTS

You may require the output to be sorted in the Inventory Item ID in ascending order.
For this we have to include a tag.

Open the group tag

Jainullabuddin B Page 43
XML REPORTS

And the tag below the available tag and Press OK

Now see the output

Jainullabuddin B Page 44
XML REPORTS

You can see that it was sorted.

Conditional Formatting
Conditional formatting occurs when a formatting element appears only when a certain condition
is met. XML Publisher supports the usage of simple "if" statements, as well as more complex
"choose" expressions.
• Insert the following syntax to designate the beginning of the conditional area.
<?if:condition?>
• Insert the following syntax at the end of the conditional area: <?end if?>.
Let us create a new template for this purpose and Load the data into it.
E:\Selvam\Selvam P.S\Materials\XML\XML Tutorial – Selvam\xtemplate5.rtf

Add the if statement into it

The Output will be

Jainullabuddin B Page 45
XML REPORTS

IF-THEN-ELSE
XML Publisher supports the common programming construct "if-then-else". This is extremely
useful when you need to test a condition and conditionally show a result.

Let us write a new Query for if-then-else in the old template itself.
Use the following syntax to construct an if-then-else statement in your RTF template:
<?xdofx:if element_condition then result1 else result2 end if?>

Type the tag as a single line [Don’t use Enter Anywhere]


The Result is as per our requirement

Choose Statements
Use the choose, when, and otherwise elements to express multiple conditional tests.
This is a very powerful feature of the RTF template. In regular XSL programming, if a
condition is met in the choose command then further XSL code is executed.

Jainullabuddin B Page 46
XML REPORTS
Use the following syntax for these elements:
<?choose:?>
<?when:expression?>
<?otherwise?>

Let us create a new template for this purpose.


E:\Selvam\Selvam P.S\Materials\XML\XML Tutorial – Selvam\xtemplate6.rtf

In the Template, write the Coding,

What our requirement is, If the Inventory_item_id = 11816, then, the contents to be highlighted
in Blue color. Output is

Let us proceed with another condition in it.


If The Inventory_item_id = 12816, then the words are to be highlighted.

Jainullabuddin B Page 47
XML REPORTS

The Output is

Now, Use otherwise into it.


All the Records to be Highlighted in red Color.

Jainullabuddin B Page 48
XML REPORTS

The Output is

ADDITION

You can perform mathematical operations in the tag itself. Let us create a new column to
show the addition of INVENTORY_ITEM_ID with 5.
In the Template, Creat one Column and write the tag in it.

Jainullabuddin B Page 49
XML REPORTS

Output

Jainullabuddin B Page 50
XML REPORTS
In the Same Way, You can add two columns also

Row Striping
If you would like a striped effect on your rows this can be achieved in the template. We now use two
almost identical data rows in the table. The native XSL position() function is used to assign each row a
numeric value, an ‘if’ statement is then used to test the value, so at the beginning of each row we get an if
statement:
1st Row: if:position() mod 2=0
2nd Row: if:position() mod 2=1
The position() function will return a number for the row of data starting at ‘1’. The mod or modulus function
will return a 0 or a 1 depending on the result e.g. 2 mod 2 returns 0 and 3 mod 2 returns a 1. So we shade
each row as required and add the if statement and at runtime the rows will be alternately shaded, in this
case blue and yellow.

The template is

This is saved as E:\Selvam\Selvam P.S\Materials\XML\XML Tutorial – Selvam\stripping


effect.rtf

The output is

If You use this for 3 lines, the coding will be

Jainullabuddin B Page 51
XML REPORTS

Auto Formatting
You can also use Word’s Table Auto Format feature to apply a style to your tables. Highlight the
table then Table > Table AutoFormat then select the style you want from the dialog

You can choose the format as You desire.

CREATING XML REPORT USING PROCEDURES


In the Modern era, we are not using RDF file to generate XML file. We can use the Procedure for
this Purpose.
1. First Declare the utlfile.
2. Next give the path to save the .xml file name. This can be stored in the selected
directories only. This can be found out using the query
SELECT *

Jainullabuddin B Page 52
XML REPORTS
FROM all_directories
The Output is

Let us Use c:\temp to store the xml file.

Don’t forget to give the extension. Ie. Xinv.xml. Here it was not give. In the next step it was
correctly given.
3. Now Write the coding to create the procedure and create the xml file.

CODING
CREATE OR REPLACE PROCEDURE xmlproc (errbuf VARCHAR2, retcode NUMBER)
IS
   myutlfile   UTL_FILE.file_type;
BEGIN
   myutlfile := UTL_FILE.fopen ('c:\temp', 'xinv.xml', 'W');
   UTL_FILE.put_line (myutlfile, '<?xml version = "1.0"?>');
   UTL_FILE.put_line (myutlfile, '<REC>');

   FOR i IN (SELECT inventory_item_id, segment1, description, creation_date
               FROM mtl_system_items_b
              WHERE creation_date > TO_DATE ('01­JAN­2008')
                AND organization_id = 204)
   LOOP
      UTL_FILE.put_line (myutlfile, '<G_INVENTORY_ITEM_ID>');
      UTL_FILE.put_line (myutlfile,
                            '<INVENTORY_ITEM_ID>'
                         || i.inventory_item_id
                         || '</INVENTORY_ITEM_ID>'
                        );
      UTL_FILE.put_line (myutlfile,
                         '<SEGMENT1>' || i.segment1 || '</SEGMENT1>'
                        );
      UTL_FILE.put_line (myutlfile,
                         '<DESCRIPTION>' || i.description || '</DESCRIPTION>'
                        );
      UTL_FILE.put_line (myutlfile,
                            '<CREATION_DATE>'
                         || i.creation_date
                         || '</CREATION_DATE>'
                        );
      UTL_FILE.put_line (myutlfile, '</G_INVENTORY_ITEM_ID>');
   END LOOP;

Jainullabuddin B Page 53
XML REPORTS
UTL_FILE.put_line (myutlfile, '</REC>');
   UTL_FILE.fclose (myutlfile);
END;

This was saved as 
Now Compile the Program.
BEGIN
   xmlproc ('a', 1);
END;

You can check the xml in the c:\temp path.

The Coding is saved in the File.


E:\Selvam\Selvam P.S\Materials\XML\XML Tutorial – Selvam\Generating XML File.prc

Jainullabuddin B Page 54
XML REPORTS
Now, Write the Coding to show output in APPS. You have to k\make slight changes in the above
coding. Instead of UTL File, Give FND File. Also, Instead of MYUTLFILE give FND_FILE.
Also delete fopen and fclose.

CODING
CREATE OR REPLACE PROCEDURE xmloutproc (errbuf VARCHAR2, retcode NUMBER)
IS
BEGIN
   fnd_file.put_line (fnd_file.output, '<?xml version = "1.0"?>');
   fnd_file.put_line (fnd_file.output, '<REC>');

   FOR i IN (SELECT inventory_item_id, segment1, description, creation_date
               FROM mtl_system_items_b
              WHERE creation_date > TO_DATE ('01­JAN­2008')
                AND organization_id = 204)
   LOOP
      fnd_file.put_line (fnd_file.output, '<G_INVENTORY_ITEM_ID>');
      fnd_file.put_line (fnd_file.output,
                            '<INVENTORY_ITEM_ID>'
                         || i.inventory_item_id
                         || '</INVENTORY_ITEM_ID>'
                        );
      fnd_file.put_line (fnd_file.output,
                         '<SEGMENT1>' || i.segment1 || '</SEGMENT1>'
                        );
      fnd_file.put_line (fnd_file.output,
                         '<DESCRIPTION>' || i.description || '</DESCRIPTION>'
                        );
      fnd_file.put_line (fnd_file.output,
                            '<CREATION_DATE>'
                         || i.creation_date
                         || '</CREATION_DATE>'
                        );
      fnd_file.put_line (fnd_file.output, '</G_INVENTORY_ITEM_ID>');
   END LOOP;

   fnd_file.put_line (fnd_file.output, '</REC>');
END;

Compile the Procedure
BEGIN
   xmloutproc ('a', 1);
END;

The Same is Saved in E:\Selvam\Selvam P.S\Materials\XML\XML Tutorial – Selvam\XML


Output in Apps.prc
Then Create the Executable as Before and follow those steps

Jainullabuddin B Page 55
XML REPORTS

Now Define the Concurrent Program

Now, Find the Request Group Name

Jainullabuddin B Page 56
XML REPORTS

Now, Include it in the Corresponding Responsibility

Now Open MS Word and Create a template

Jainullabuddin B Page 57
XML REPORTS

It is saved as E:\Selvam\Selvam P.S\Materials\XML\XML Tutorial – Selvam\proc_temp.rtf

Now, Open the XML Publisher Administrator and define the Data.

Now create the template

Jainullabuddin B Page 58
XML REPORTS

Give the New Template Name


Now, Run the Program in Apps

Now, See the Output

Jainullabuddin B Page 59
XML REPORTS

Successfully Completed.
• An Important Thing to note here is – It is not necessary to have installed XML
in Your system. Without Loading the data You can see the output

LINK BETWEEN RDF AND XML


If You open the property Pallete in the Data Model of RDF, You can see the XML
SETTINGS Property. This will be helpful in the case of creation of XML Tags.

Jainullabuddin B Page 60
XML REPORTS

XML Tag
You can change the name of the XMl Tag while generating the XML Tags.
Previously, the tag will be

Now Give the Name as Dates. Save it and Generate into XML File and Save it as

IN the Tag, You can see as Dates

XML TAG ATTRIBUTES

Jainullabuddin B Page 61
XML REPORTS
Let us Give an Attribute

The XML Output will be

It will just add


The Output is saved in E:\Selvam\Selvam P.S\Materials\XML\XML Tutorial –
Selvam\xinv1.xml

EXCLUDE FROM XML OUTPUT


As the name indicates, it will exclude that item from the XML tag.

OUTPUT

Jainullabuddin B Page 62
XML REPORTS

You can see the absence of description here. The OUTPUT is saved in
E:\Selvam\Selvam P.S\Materials\XML\XML Tutorial – Selvam\xinv2.xml.

PLAY WITH INVOICES


This part is just a continuation from RTF templates. What we do here is more learning
about RTF templates using the in-build given examples from XML Publisher.
For this purpose, we write a query to get some details about invoice
SELECT invoice_num, invoice_date, a.invoice_currency_code, a.gl_date,
       a.invoice_amount
  FROM ap_invoices_all a
 WHERE invoice_date < TO_DATE ('30-JAN-1996')

Write a Procedure and create the XML code using the procedure
CREATE OR REPLACE PROCEDURE invoice_code (errbuf VARCHAR2, retcode NUMBER)
IS
   myutlfile   UTL_FILE.file_type;
BEGIN
   myutlfile := UTL_FILE.fopen ('c:\temp', 'invoice.xml', 'W');
   UTL_FILE.put_line (myutlfile, '<?xml version = "1.0"?>');
   UTL_FILE.put_line (myutlfile, '<REC>');

   FOR i IN (SELECT invoice_num, invoice_date, a.invoice_currency_code,
                    a.gl_date, a.invoice_amount
               FROM ap_invoices_all a
              WHERE invoice_date < TO_DATE ('30­MAR­1996'))
   LOOP
      UTL_FILE.put_line (myutlfile, '<G_INVOICE_NUM>');
      UTL_FILE.put_line (myutlfile,
                         '<INVOICE_NUM>'||i.INVOICE_NUM||'</INVOICE_NUM>'
                        );
      UTL_FILE.put_line (myutlfile,
                         '<INVOICE_DATE>'||i.INVOICE_DATE||'</INVOICE_DATE>'
                        );
      UTL_FILE.put_line
         (myutlfile,
          '<INVOICE_CURRENCY_CODE>'||
i.INVOICE_CURRENCY_CODE||'</INVOICE_CURRENCY_CODE>'
         );
      UTL_FILE.put_line (myutlfile, '<GL_DATE>'||i.GL_DATE||'</GL_DATE>');
      UTL_FILE.put_line

Jainullabuddin B Page 63
XML REPORTS
(myutlfile,
'<INVOICE_AMOUNT>'||
i.INVOICE_AMOUNT||'</INVOICE_AMOUNT>'
                      );
      UTL_FILE.put_line (myutlfile, '</G_INVOICE_NUM>');
   END LOOP;

   UTL_FILE.put_line (myutlfile, '</REC>');
   UTL_FILE.fclose (myutlfile);
END;

Execute the Procedure using
begin
 invoice_code('a',1);
 end;

The code will be generated in the C:\temp folder. Copy this and paste it in your area and load the
data. Insert all those fields

Repeatable Row Headers


If your invoices break across a page and you want to repeat the column header row this can be
achieved using MSWord’s functionality.
1. Highlight the header row
2. Table > Table Properties
3. Under the Row tab select the ‘Repeat as Header row at the top of each page’
If the invoices table breaks across a page the header row will be repeated

Jainullabuddin B Page 64
XML REPORTS

Now You will get the rows repeated.

Splitting Rows across pages


You can prevent rows splitting across a page break by using MSWord’s funtionality:
1. Highlight the data row
2. Table > Table Properties
3. Under the Row tab deselect the ‘Allow row to break across pages’
Rows that would normally be split across two pages will now be moved to the second page to preserve
the row data

Jainullabuddin B Page 65
XML REPORTS
Using Groups
Let us use groups in the query for this we have created the RDF file .
E:\Selvam\Selvam P.S\Materials\XML\XML Tutorial – Selvam\ invoice.rdf
We have included Vendor_id for this purpose and Group the Query using the vendor_id

Now design the template and save as

E:\Selvam\Selvam P.S\Materials\XML\XML Tutorial – Selvam\ invoice2.rtf

Loaded data is from E:\Selvam\Selvam P.S\Materials\XML\XML Tutorial – Selvam\


invoice1.xml

Output is Like

Jainullabuddin B Page 66
XML REPORTS

The output is shown after grouping

Totals
Adding a total at the Vendor level is very straightforward. We add a new table with a single row after the
invoices table

Write the Query in the template.


E:\Selvam\Selvam P.S\Materials\XML\XML Tutorial – Selvam\ invoice3.rtf
Load the data from E:\Selvam\Selvam P.S\Materials\XML\XML Tutorial – Selvam\ invoice1.xml

Jainullabuddin B Page 67
XML REPORTS
This will give the sum for every Vendor

You can get the total in the report level also

Output is

Jainullabuddin B Page 68
XML REPORTS

Number Formatting

You can format the number in the following form field

(#,###.00) is used for negative values.

REGROUPING
If You want to use Grouping By Currency Code inside the existing group, You can add this.
For this ,we have created a template E:\Selvam\Selvam P.S\Materials\XML\XML Tutorial –
Selvam\ invoice5.rtf

Jainullabuddin B Page 69
XML REPORTS

The Output will be

It was regrouped using the Currency Code also


You have to add a tag,

Jainullabuddin B Page 70
XML REPORTS
<?for-each-group:G_INVOICE_NUM;INVOICE_CURRENCY_CODE?>

ERRORS FACED
1. If we are opting to see the output in Excel Format, the following error occurs,
ERR 01403 : No Data Found

SOLUTION

SUMMARY
1. Develop the report without layout.
2. Register the report with Oracle applications in normal way.
3. While registering the report select the out put type as xml instead of text (in general
we will give as text).
4. Assign to a request group.
5. Once after running the report from the application we will get the out put in the form
of xml tags.
6. Save the Out put xml tags in file (this out put file will be the in put for the template
generation).
7. Develop the Template and save it in .rtf format
8. Create Data Definition
9. Create the Template in Apps
10. Run the Report in the Apps

Jainullabuddin B Page 71

You might also like