Sunday, November 13, 2011

BI Publisher 11G: Creating a report in BI Publisher 11G - Step by Step Process

BI PUBLISHER 11G DOCUMENTATION
PART -1
Creating a Report:-
-          Create a Data Model to get XML Data.
a)     

Save this Data Model. It will be saved as .xdmz
b)      Next step is to create a Data Set. 
Click ‘OK’ once the query is ready.
If Query has Parameters then it will pop up the following.
               ---->                     
Click “OK”, then it will create Parameter by itself.

c)       Parameters:-
Since here we are going to use LOV’s for BILLING_ELEMENT, first need to create List of Value for this parameter.
                                           
                                                Here the Type is SQL Query, based on the requirement change the Type to Fixed Data.
Go, back to Parameters and change the Parameter type to Menu
In Menu Setting, if you have more than one LOV’s then select the relevant List of Values to the parameter
So, now the Data Model is ready for XML Output
Go to the tool bar click GET XML Output icon.
                                Give the necessary Parameters Values and run it.


The output which shows up is what XML Data.
To Prepare a layout you need to have the XML Data. So, Export it to your local drive.

                                So, the first part is done.
-          Now, we need to prepare a layout. For prepare Layout I prefer going from MS word Add inn. For, this needs to install BI Publisher Desktop .exe file.
Once you done with your installation you will see a Add-Ins on the toolbar

Insert the XML data:-                       

If the data is successfully loaded then it will pop up

Then, go to Field and insert the field wherever required.
         ------------>         


                                This is a sample layout:-
                               
You can preview the results here itself in whatever formats you wish among the drill down.
                                Save this MS Word file as .RTF file.

-          Now the layout is ready, now it is to be uploaded back to BI Publisher 11g.

Go to Catalog and click on New which appears on the left side of the toolbar. Select Report which is nothing but .rtf file.


Then it will ask you to select the Existing Data Model to which you want to upload this .rtf layout

Select the Data Model and Click OPEN.
Upload the .rtf layout Click on Upload.


Give a name and the path where you saved your .rtf file on your local drive.
And Click Upload.

The file will be uploaded. Now, save the whole the data model and .rtf file as a package. This file will be saved as .xdoz
 Now, we need to View the result.


PART – 2
 Downloading and uploading a file.
Go the Catalog to the file which you want to download.
Then click on “More” and then download to save the file in your local drive.

This file will be saved as .xdoz file.  This .xdoz  file contain both the Data model and .rtf file.  
Note:-  (a) .xdoz  =  .xdmz + .rtf. 
(b) When it comes to SharePoint always upload both .xdoz and .xdmz files.
Uploading  a .xdoz file.                
                Go to the Catalog and there you will see an Icon “Upload Resource”.

Browse the file from where you saved.
Save this .xdoz file at destination folder.
                Note:- If just incase you want to overwite existing file, then check the box.
The file is saved.


Click Open to run the report.
Note:- Just in case you want to get the .xdmz file from this, you need to go back to DATA MODEL. So, go to Actions and click on Edit Report. Click on Data Model  which is on the top left side.
The data Model will be opened. Then Click Save As and give the destination folder where you want to save the .xdmz file.

Same process for uploading .xdmz file.


PART – 3
Style Template:-
 It is also like a Sub Template. Like you want a set of Reports Font size to be same for Column Headers and body. Then, instead of doing it for all the reports prepare just one .RTF template by using Style and Formatting.
Upload it.
               
Upload it and save it at destination folder.
Now when you edit the report, you will see View a list beside View Thumnnails. Click View  a List.
Apply the Style Template which you wanna use and also don’t forget to check the box “Apply Style Layout”
NOTE:- 1) some of the styles which can be used like for Table Styles, Header and Footer Content.
2) If a header and footer have been defined in the report layout, they will be overwritten. The header and footer from the style template will be applied.
3) Prefer not to use “Style Templates”. Let us do this work when creating a (.rtf) layout itself.
Part 4:-
Subtemplate:-
Purpose: - This is a common template for all the reports which are in common. You can import this file path into your layout and execute.  Just in case if the Design changes later after building all the reports, then just changing the subtemplate works. No need of changing by going into each and every layout.
Example:-
<?template:Header1?>
<?end template?>


<?template:Header2?>
Generated:
11/13/2011
<?end template?>

So, in the subtemplate we have the above two things. Now you need to import this into your layout(as below).
<?import:file:///c:/subtemplate/subtemplate.rtf?>
<?call-template: Header1?>






<?call: Header2?>

So, now if just incase you need to change the header for all the reports, then just changing on sub template is good enough.
Uploading a Subtemplate in BIP 11g:-
And save it at desired Folder. Need to give that folder path in the layouts just in case you want to use that subtemplate.

Errors:-
1)      When you want to modify a already existing layout from report. Needs to Click on Edit and Open. Do the necessary modifications and save it.
But when trying to save it pop ups an error






2)      The following error pops up sometime when I try to upload a layout

3)      When I am trying to use the BIP 11g path of the subtemplate in the Reports, the output does not shows up. Needs to work on this???
4)      When we try to delete the xdoz file, sometimes a pop up shows as below.?????

PART – 5

A)     MISSING COLUMNS:-

Customer Account
Customer Name
IFIFAccount Jurisdiction
Starttime
Billing Element
Billing Element Description
Numeric Value
UOM
F CUSTOMER_ACCOUNT
CUSTOMER_NAME
IFIFACCOUNT_JURISDICTION
TO_CHAR_C_STARTTIME__YYYYMM__
BILLING_ELEMENT
BILLING_ELEMENT_DESCRIPTION
$,0.99($,9.00)
UNIT_OF_MEASURE E
 ***End of Report***

B)      PARAMETER VALDATIONS(will be useful for hiding the entire table just in case you don’t have any data in it):-


<?choose:?>
<?when:BILLING_ELEMENT=''?> Please Enter Billing Element Value <?end when?>
<?otherwise:?>
<?choose:?>
<?when:count(G_1) > 0?>
BILLING_ELEMENT:
BILLING_ELEMENT






Customer Account
Customer Name
Account Jurisdiction
Starttime
Billing Element
Billing Element Description
Numeric Value
UOM
F CUSTOMER_ACCOUNT
CUSTOMER_NAME
ACCOUNT_JURISDICTION
TO_CHAR_C_STARTTIME__YYYYMM__
BILLING_ELEMENT
BILLING_ELEMENT_DESCRIPTION
$,0.99($,9.00)
UNIT_OF_MEASURE E
 ***End of Report***
<?end when?>
<?otherwise:?>No Data Found<?end otherwise?>
<?end choose?>
<?end otherwise?>
<?end choose?>

C)      TOTALS AND SUBTOTALS:-
The following are the variables which will be useful when we use Variables (set and get Variables)
INIT_FLAG
SET_FLAG
numeric value
IF_FLAG numeric_value EN

D)     MULTIPLE BILLING_ELEMENTS IN A SINGLE ROW:-
(This is a sample layout, from the report WP_JOCOB_045 for Buyer NCEMC)
LINE NO.
(10)
DESCRIPTION
(20)
UNIT 2
(50)
SUPPORT FACILITIES
(60)
TOTAL
(70)
10
F IFBILLING_ELEMENT_DESCRIPTIONend ifEF
F IFNUMERIC_VALUEend ifEF
F IFNUMERIC_VALUEend ifEF
F IFNUMERIC_VALUEend ifEF  
20
DIRECT LABOR COST
F IFNUMERIC_VALUEend ifEF
F IFNUMERIC_VALUEend ifEF
F IFNUMERIC_VALUEend ifEF  
30
INDIRECT COST
F IFNUMERIC_VALUEend ifEF
F IFNUMERIC_VALUEend ifEF
F IFNUMERIC_VALUEend ifEF  
40
TOTAL (L10+L20+L30)
F IFNUMERIC_VALUEend ifEF
F IFNUMERIC_VALUEend ifEF
F IFNUMERIC_VALUEend ifEF  
50
PROJECT OWNERSHIP %


F IFNUMERIC_VALUEend ifEF
60
OWNERSHIP COST (L40*L50)


F IFNUMERIC_VALUEend ifEF
70
MONTHLY ADVANCE PAID


F IFNUMERIC_VALUEend ifEF
80
ADJUSTMENT (L60-L70)  (TO OM 100, L40)


F IFNUMERIC_VALUEend ifEF

Note:-  1)  Here for Description I prepared in both ways:
A)     hardcoded(C20, L20-80)
B)      Just in case you want to pull Description from BILLING_ELEMENT_DESCRIPTION, for this you can see C20, L10