Friday, March 21, 2008

Converting RDF Reports to XM Publisher

One of my friends was working on converting 11.5.10 RDF reports into XML Publisher reports. Not a very strange requirement, considering everyone now wants to move to XML Publisher. What however, was strange was the approach followed. Instead of following Approach 1 they opted for Approach 2, listed below.

Approach 1 : Convert the output format of Standard report to XML, create a new RTF template and register a Data Definition and Template with XML Publisher.

Approach 2 : Convert the RDF report into XML Report and use this XML as a Data Template. Create a new XML Publisher report Data Definition with this XML as Data Template and create a new Template.

The problem with Approach 2 is that Oracle provides no tool to convert Reports 6i into XML Report and any other supporting APIs to handle associated PL/SQL logic embedded into RDF.

Enter Reports 9i (or higher) and XML Publisher 5.6.3. These two combinations of Oracle products provide tools to first convert RDF report into XML report and associated XML Publisher API to handle PL/SQL logic.

This is how it works.
-----------------------------
Oracle Reports contains both Data Model (logic) and Layout (presentation) in a single file. In XML Publisher they are stored separately. Therefore migration involves a 2 step process.

Step 1 RDF to XML format report : Oracle Reports 9i (or higher) comes with utility "rwconverter.exe". Use either Reports Designer or "rwconverter.exe" command line to convert RDF into XML format report.

From the Designer :


The following command executes “rwconverter.exe” utility, taking the source report,
XXTEST.rdf and converting it to an RDF-XML format that can be consumed by the
XML Publisher conversion utility.

Note the dtype must be specified as "xmlfile".
\BIN>rwconverter batch=yes source= c:\XXTEST.rdf
dest= c:\XXTEST.xml dtype=xmlfile overwrite=yes



This would create an RDF-XML file, with all the PL/SQL logic and presentation logic.

Step 2.1 Data Model Migration :
XML Publisher 5.6.3 provides a Java API Package "oracle.apps.xdo.rdfparser". This package has "DataTemplateGenerator" class that creates a DataTemplate from the XML report file. If report has triggers this will generate '.pks' and '.pkb' file for that trigger which needs to be compiled into the Database

Example
javaw.exe oracle.apps.xdo.rdfparser.DataTemplateGenerator c:\XXTEST.xml

Output Files:
PL/SQL Package : XXTESTS.pls
PL/SQL Body : XXTESTB.pls
DataTemplate : XXTEST_template.xml

Here is a sample XML output file. Notice the "defaultPackage", "dataTrigger" etc that contain reference to PL/SQL API.


<?xml version="1.0" encoding="UTF-8" ?>
<dataTemplate name="XXTEST" defaultPackage="XXTEST" version="1.0">
<properties>
<property name="xml_tag_case" value="upper" />
</properties>
<parameters>
<parameter name="P_CONC_REQ_ID" dataType = "number"></parameter>
</parameters>
<lexicals>
</lexicals>
<dataQuery>
<sqlStatement name="Q_Main">
<![CDATA[
SELECT user_name, user_id
FROM xxuser
]]>
</sqlStatement></dataQuery>
<dataTrigger name="beforeReportTrigger" source="XXTEST.beforereport"/>
<dataStructure>
<group name="G_1" dataType="varchar2" source="Q_Main">
<element name="user_name" dataType="varchar2" value="SEGMENT_VALUE"/>
<element name="user_id" dataType="number" value="VALUE_SET"/>
</group>
</group>
<element name="CP_segment_name" dataType="varchar2" value="XXTEST.CP_segment_name_p"/>
<element name="CF_RUN_DATE" dataType="USDate" value="XXTEST.cf_run_dateformula()"/>
<element name="CF_NAME" dataType="varchar2" value="XXTEST.cf_nameformula()"/>
</dataStructure>
<dataTrigger name="afterReportTrigger" source="XXTEST.afterreport()"/>
</dataTemplate>


Step 2.2 Data Model Migration :
XML Publisher 5.6.3 API Package "oracle.apps.xdo.rdfparser" has "RTFTemplateGenerator" class to migrate the Oracle Reports layout to an XML Publisher RTF template. Because there is no support for PL/SQL in an RTF Template, the generator writes all Oracle Report format trigger code to the log file. This must later be implemented as XSL code

Example
javaw.exe oracle.apps.xdo.rdfparser.RTFTemplateGenerator c:\XXTEST.xml

Output Files:
RTF Template : C:\XXTEST.rtf
Log File : C:\XXTEST.log

That’s it we are done with the conversion.
Now that we have converted the RDF into XML publisher report, we simply need to use the Data Template and RTF to register with the XML Publisher.

Step 3 : Register a new Data Definition with XML Publisher Responsibility, with XML file generated as part of Step 2.2 as Data Template. Register the RTF template for the DD.

Step 4
: Create a Concurrent Report Program with Report output as XML and executable as "XDODTEXE". XDODTEXE is XML Publisher Data Template Executable Engine, which is a Java Concurrent Program.



That’s it. We have traced the steps involved to convert an existing RDF into an XML Publisher Report for 11.5.10.

I will write more on XML Publisher in my subsequent blogs.

Till then keep reading my blog and feel free to write your comments.

Cheers
~Neeraj

18 comments:

AragoRn said...

Hi Neeraj

Let me congratulate u for ur effort in sharing ur knowledge about BI Publisher. Nice & easy to understand article on migrating RDF to BI Publisher report.

I was able to convert the RDF report successfully using RTFTemplateGenerator & DataTemplateGenerator.

I came across another utility "BIPBatchConversion" which internally follows calls the above two classes. When i ran the class, Im getting "Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/java/util/collections/ArrayList"

I have included collections.jar in my java.exe command

Please comment.

Regards,
Kishore Ryali

Venky said...

Hi Neeraj,

This is a very nice and very useful article.

Thanks,
Venkatesh n

Anonymous said...

can you please give me the names of few xml publisher reports in oracle applications.

Anonymous said...

please let me know how/where to run the command from in windows
thanks in advance.
munna
javaw.exe oracle.apps.xdo.rdfparser.DataTemplateGenerator c:\XXTEST.xm

aleeraj said...

Nice article to convert oracle report into XML.
I need to convert this XML report into Excel. can you suggest me an easy way.

Anonymous said...

Whats with the Black background on your site??
Black indicates Porn.

Sai said...

Neeraj,

How do I install BI 5.6.3 on Windows in standalone mode?

Thanks
Sai

Anonymous said...

Hi Neeraj,

I've converted RDF into XML Publisher report. The desired output of the XML report should be in Excel.

When the XML report is executed from self service responsibility I'm successful at the Excel output in Microsoft Excel. However, when I try achiveing the same from a non self service responsibility I get an XSL ouput.

Could you shed some light on how to get an Excel output (in Microsoft Excel) from XML report from a non self service output.

I've tried setting the profile Viewer Text to browser, which open the output in Excel. However, while trying to save the output file is not very user friendly.

Any inputs is appreciated.

kJ said...

Hi Neeraj,

Thanks,for the good work.

Also ,If you can share something about the integration of DBI reports and BI Publisher report,any thoughts would be great.

Thanks,
KJ

Anonymous said...

Hi,

I have installed Oracle 9i Relase 2 database and 10g (9.0.4.0) DS in windows 2003 server. I am facing problem when I run my report through show.web_document. It is possible to run your report through show.web_document when both the envirnoments are in the same machine. Or still we need to install 10AS for Report server?

Many thanks in advcance.

REgards
Umer

Rahul said...

Nice information. I have converted the .rdf report to the XML publisher report. While triggering the report from the application, the report is erroring out and is giving the following error:

XDO Data Engine Version No: 5.6.3

Calling XDO Data Engine...
java.lang.NullPointerException
at oracle.apps.xdo.dataengine.DataTemplateParser.getObjectVlaue(DataTemplateParser.java:1754)
at oracle.apps.xdo.dataengine.DataTemplateParser.replaceSubstituteVariables(DataTemplateParser.java:1473)
at oracle.apps.xdo.dataengine.XMLPGEN.processSQLDataSource(XMLPGEN.java:456)
at oracle.apps.xdo.dataengine.XMLPGEN.writeData(XMLPGEN.java:445)
at oracle.apps.xdo.dataengine.XMLPGEN.writeGroupStructure(XMLPGEN.java:308)
at oracle.apps.xdo.dataengine.XMLPGEN.processData(XMLPGEN.java:273)
at oracle.apps.xdo.dataengine.XMLPGEN.processXML(XMLPGEN.java:215)
at oracle.apps.xdo.dataengine.XMLPGEN.writeXML(XMLPGEN.java:254)
at oracle.apps.xdo.dataengine.DataProcessor.processDataStructre(DataProcessor.java:390)
at oracle.apps.xdo.dataengine.DataProcessor.processData(DataProcessor.java:355)
at oracle.apps.xdo.oa.util.DataTemplate.processData(DataTemplate.java:348)
at oracle.apps.xdo.oa.cp.JCP4XDODataEngine.runProgram(JCP4XDODataEngine.java:293)
at oracle.apps.fnd.cp.request.Run.main(Run.java:157)

Rahul said...

PLease help me in resolving the above mentioned error

swati said...

Nice blog..helped me a lot!!

Sarfraz said...

hello there i am also having the error
Calling XDO Data Engine...
java.lang.NullPointerException
at can you please help, here is xml of my rdf report. i have noticed that there is a lot of difference in your DTD and mine! i developed the report in 6i and then brought it on my desktop to convert it into xml using rwconverter since pc m developing the reports on has 6i and i cannnot install reports 9i or 10g there.....do you think it could be the problem also please comment on the xml DTD and how can i correct it.

Your comment box is not allowing me to paste the DTD so please help...!

Anonymous said...

Hi Neeraj Srivastava.

I read you article about
migrating RDF to BI Publisher report.

But I still have difficulties to follow steps of migration since my age is now 50 years... but still can make reports in RDF...

I am working now with Oracle EBS and i have difficulties to modify reports written in XML.

So I was thinking if there is a way to migrate from BI Publisher report XML to RDF.

I will be gratefull if you can help.

Thanks

Nasr Noman

email:nasr_noman@hotmail.com

Anonymous said...

Thanks a lot It worked like a charm..

bryan said...

Hi Neeraj Srivastava,
thanks for your article first!
I am converting reports from oracle report 6i to BIP10.1.3.4.1 using the convert utility tool.
after converted ,I got 2 kinds of files:data_templete.xml and layout.rtf.
the problem is ,my BIP system is standalone,not integrated with oracle ebs,so ,the BIP report file should contains:###.xdo,###.rtf. now,how can i load the converted files into BIP system?
thanks so much

Word to PDF said...

This tutorial will help me a lot in my conversions projects..