You are on page 1of 2

Steps to be followed For Developing a Report in BI Publisher

1. Install BI Publisher on Client Machine.


2. Install .Net Framework 5.0
3. Install BI Publisher Desktop Addition on Client Machine.
4. Develop Procedure for Data Fetching in XML Format and Register the procedure With Oracle apps as
XML Type Report (Code Enclosed as Sample Script).

--------------------------------------------------Start Script-------------------------------------------------------
CREATE OR REPLACE PROCEDURE INV_DETAILS_XPROC(ERRBUF VARCHAR2,RETCODE
NUMBER,P_ORG_ID NUMBER)--,P_FROM_DATE VARCHAR2--,P_TO_DATE VARCHAR2)
AS
/*CURSOR TO FETCH CUSTOMER RECORDS*/
CURSOR XML_INV_DET
IS
SELECT TO_CHAR(CV.TRX_DATE,'MON') MON,
CV.CUSTOMER_NAME,
CV.TRX_NUMBER INV_NO,
CV.TRX_DATE INV_DT,
CV.ITEM_CODE,
CV.QUANTITY,
CV.NRV
FROM CNS_INV_V CV
WHERE TRUNC(TRX_DATE) BETWEEN '01-NOV-2009' AND '30-NOV-2009'
AND ORG_ID=105--P_ORG_ID
AND TERRI_SEG2 LIKE 'Zone%'
AND ROWNUM<10;
----------------
BEGIN
/*FIRST LINE OF XML DATA SHOULD BE '<?xml version="1.0"?>'*/
FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<?xml version="1.0"?>');
FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<INVINFO>');
FOR V_CUSTOMER IN XML_INV_DET
LOOP
/*FOR CUSTOMER INVOICES CREATE A GROUP TAG <P_INVOICES> AT THE START*/
----------------------------
FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<P_INVOICE>');
----------------------------
/*EMBED DATA BETWEEN XML TAGS FOR EX:-
<CUSTOMER_NAME>ABCD</CUSTOMER_NAME>*/
FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<MONTH>' || V_CUSTOMER.MON ||
'</MONTH>');
----------------------------
FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<CUSTOMER_NAME>' ||
REPLACE(REPLACE(V_CUSTOMER.CUSTOMER_NAME,' ',''),'&','')
|| '</CUSTOMER_NAME>');
----------------------------
FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<INVOICE_NO>' || V_CUSTOMER.INV_NO ||
'</INVOICE_NO>');
----------------------------
FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<INVOICE_DATE>' || V_CUSTOMER.INV_DT ||
'</INVOICE_DATE>');
----------------------------

FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<ITEM_CODE>' || V_CUSTOMER.ITEM_CODE ||
'</ITEM_CODE>');
----------------------------

FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<QUANTITY>' || V_CUSTOMER.QUANTITY ||
'</QUANTITY>');
----------------------------

FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'<NRV>' || V_CUSTOMER.NRV ||
'</NRV>');
----------------------------

FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'</P_INVOICE>');
END LOOP;
/*FINALLY CLOSE THE STARTING REPORT TAG*/
FND_FILE.PUT_LINE(FND_FILE.OUTPUT,'</INVINFO>');
----------------------------
EXCEPTION WHEN OTHERS THEN
FND_FILE.PUT_LINE(FND_FILE.LOG,'ENTERED INTO EXCEPTION');
END INV_DETAILS_XPROC;
/

--------------------------------------------------End Script-------------------------------------------------------

5. Now run this Report to generate output in XML Format and save it to your desktop or any specified folder
with XML Extension (Test.xml)
6. Develop a template using this data.
>Open MS WORD and then load the xml file using BI Publisher Add Ins (Data-> Load XML DATA).
>Now go to Insert and select Table/Form from the Menu
>Drop the data source to Template and then press OK.
> Now Save the generated Word File as .rtf Extension (Test.rtf)
7. Now With Responsibility XML Publisher Administrator Register Data Definition and Template.
> While Creating Data Definition we have to specify the Name ( Concurrent Program Name) , Code
(Concurrent Executable Name) , Application ( This is Application Name in Which we have Registered the
Program), Start Date (sysdate) , XML Schema ( Select the Concurrent Program Output which we have
saved as .xml in Step -5(Test.xml)) and after filling all the details then press apply.
>While Creating Template we have to specify the Name ( Concurrent Program Name) , Code (Concurrent
Executable Name) , Application ( This is Application Name in Which we have Registered the Program),
Data Definition (This is the name of the data definition which we have created in previous step) ,Start Date
(sysdate) , Type ( Select this as RTF) ,Template File ( Select the .rtf file which we have created in Step-6
(Test.rtf)) , Language( English) , Territory(India) and after filling all the details then press apply.
8. Now go to sysadmin Install-> Viewer Options and add one line for XML.
File Format-> XML Mime Type-> application/vnd.ms-excel Description-> Microsoft Excel
9. Now Run the Report from the responsibility and you can see the output.

You might also like