Monday, May 19, 2008

RDF to XMLP Report Conversion Continued...

Here I am once again, with small sack of information on RDF Repot to XMLP Report Conversion.

This time, there are no high fundas. This article will contain a step-by-step explanation of the entire conversion procedure with examples and screenshots.


Prerequisites:

1) You have a perfectly working RDF report that is registered as a Concurrent Program

2) You have all the required responsibilities to create a concurrent program and also the XML Publisher Responsibility to register the data definition and templates.

3) You have some basic idea of XML and XSLT. If not, you can refer the w3schools site:


4) You have the required utility in your MS Word that facilitates the creation of RTF Template.

If not, you can download it from



Ok, so lets get started.

I shall convert the BR vacation report which is in RDF to the XMLP Report.


1) Copy the existing CP to create a new CP with relevant short_name, executable as XDODTEXE which is a Java Concurrent Program that will read the XML data Definition and execute the query in it to generate the desired output and output format as 'XML' as shown below:

2) While defining the parameters, make sure you are passing the token value.

Two Points to note here are :
1. The short name of the registered CP should be exactly same as the code name of the data definition .
2. The token passed should exactly match the parameter name defined in the data definition. Both should be in the same case.

3) Now we shall create the data definition. Here is the data definition xml file for your reference:
So that's the data definition xml that you can use as sample.

As you can see, in the xml data definition,

1.We first declare the version and the encoding which is by default UTF-8. '

2.Then we give a name to the data definition followed by the names of the corresponding pl/sql
package name the data definition refers so as to derive the values of the formula columns or
pl/sql logic for the report triggers etc.

3. Then comes the property tag that specifies the case of the xml tags here. We can declare other
properties too in this segment if we want and we may even totally avoid this segment.

4. Then comes the parameter segment where we declare the parameters that we would we
passing through our CP. The case and name of the parameter should exactly match the token
we pass while declaring the parameters.

5. Followed by the parameter is the sql query which is essentially same as the sql query in the
RDF report. But any formula columns that we calculate in separate program unit inn the RDF
report, has to be calculated here , in this query section in xml report. For such calculations, we
can directly refer the packaged functions or procedures. For eg : If we want a formula column
CF_Employee_age. Then we can write the pl/sql logic of calculating the age of an employee in
the packaged function MISPER_BR_VABAL.age. he logic here will be same as the logic in the
RDF program unit for CF_Employee age but here we write it in tha packaged function and call
it the query section as select ...., MISPER_BR_VABAL(p_employee_date_of_birth)
CF_Employee_age .....from ....., where...... ( Assuming p_employee_date_of_birth is one of our
user parameters declared in the parameter section or some column of any table.

Here , an important point to note is that, if the packaged function internally calls any other function that uses any DML, DDL, or TCL on any temporary table then we might get an error. This is because, here we are calling the function from a sql statement and functions performing DML, DDL or TCL are not allowed to be called from sql statement. In such cases, we might have to declare the DML, DDL or TCL performing function as PRAGMA AUTONOMOUS_TRANSACTION so that it is executed as an independent program unit.

6. After the query section, we declare the report triggers which again have their code wriiten in packaged functions or procedures.

7. In the data structure portion, we first write the grouping information followed by the element names. If we have any summary columns, we declare them here. For eg :

Here, we declare two summary columns and one formula column.

4) Once this much is done , we register the data definition through the xml publisher Administrator responsibility as shown below :
As mentioned earlier, the code name should be same as the CP short name. That is how the executable identifies the data definition corresponding to a CP.

5) Now, we need to create the RTF template. For this we will first run the CP and save the output as the xml file. Then we shall open MS Word and load the XML file using the Oracle BI Utility as mentioned in teh Prerequisites. Following this we shall add the data fields as required on the RTF file and save it. Here is a sample RTF File :
6) The data fields generally have a structure like this:
7) In the 'Add Help Text' , we write the actual data tag or any formatting trigger in XSLT that is to be picked from the output XML. The default text is just a place holder for the actual data and can be written as anything. For example, we want to display a particular layout only if the value of a particular parameter is 'N' then, in XSLT the condition can be written as follows:
8) Ok, now once we have the RTF template ready, we need to check if this is fine. For doing so, we load the XML output obtained earlier in step 5) and then check the preview in pdf or html or excel or text. If this is ok and we are satisfied with the output, then we register the template.

9) For registering, we again go to the XML Publisher Administrator Responsibility, and the go to Template Definition and register the template as follows:
10) Now, we have the CP, the data definition as well as the RTF template in place.

Our steps our almost done. Now we only need to run the CP and check the output.

OK, one important point, while declaring the CP Parameters, you need to declare one additional parameter DebugFlag only for test purposes as follows:
This is just to debug the report in case we are getting errors. You can set this to 'N' in case you don't want it and you can also remove this once everything is working fine. Remember, you do not need to declare this parameter in the data definition or in the packages or anywhere else . The CP executable XDODTEXE knows how to handle this.

11) Just for you reference, I am pasting the codes of a sample package spec and package body:
This is the MISPER_BR_VABALS.pls and below is the pkg body MISPER_BR_VABALB.pls:
So that completes all the components of the XML report.

Just a reminder : Before running the CP at step 5), make sure that you have compiled the pkg spec and pkg body on the same instance where you are submitting the CP.

Thisn completes the entire RDF to XML Conversion process.

I shall try to discuss some common errors we face and the troubleshooting that requires to be done in my next blog.
Till then , do try this out and let me know how it works. Hope this helps everyone who reads it and surely me so that I donot forget the steps.

Ok, then, its too late for me already 8:30pm and I am still in office. I got to go. Bbye and take care.

Oracle RDF Report to XML Publisher Report

Nowadays I am working in a project that requires few existing RDF reports to be converted to XML Reports. So I thought of sharing the little knowledge that I have gained while working on this project.

First question that would come to anyone's mind is :
Why do we need to convert RDF eports to XML?

Successful migration of RDF report to BI Publisher will allow the customer to take avantage of the many benefits found in BI Publisher including:

  • · Access to heterogeneous databases
  • · Zero footprint, fully web based architecture
  • · Low cost of setup and Administration
  • · Simple reports development and low cost of reports maintenance
  • · Wide range of delivery support (Printer, Fax, Email, WebDAV, FTP/HTTP)
  • · Multi-language support
  • · Performance improvement
  • · Improved Scheduling functionality
  • · Data Caching
  • · Security enhancements

Oracle XML Publisher is a template-based publishing solution delivered with the Oracle E-Business Suite. It provides a new approach to report design and publishing by integrating familiar desktop word processing tools with existing E-Business Suite data reporting. XML Publisher leverages standard, well-known technologies and tools, so you can rapidly develop and maintain custom report formats.

The flexibility of XML Publisher is a result of the separation of the presentation of the report from its data structure. The collection of the data is still handled by the E-Business Suite, but now you can design and control how the report outputs will be presented in separate template files. At runtime, XML Publisher merges your designed template files with the report data to create a variety of outputs to meet a variety of business needs, including:

  • • Customer-ready PDF documents, such as financial statements, marketing materials, contracts, invoices, and purchase orders utilizing colors, images, font styles, headers and footers, and many other formatting and design options.
  • • HTML output for optimum online viewing.
  • • Excel output to create a spreadsheet of your report data.
  • • "Filled-out" third-party provided PDF documents. You can download a PDF document, such as a government form, to use as a template for your report. At runtime, the data and template produce a "filled-out" form.
  • • Flat text files to exchange with business partners for EDI and EFT transmission.
So now we know the advantages of converting the RDF to XML Publisher report. But how do we go about it?
What are the steps involved in the RDF to XMLP report Conversion Process?

The overall flow can be diagrammatically represented by the following figure:

Pre-Requisites

The migration APIs accept an Oracle Report in XML Format, this format is only supported in Oracle Reports 9i and above. Therefore you need to have a 9i+ version of Oracle Reports available. For R12 the Oracle Reports version in the techstack is 10.1.3 so the conversion to RDF XML is straightforward. For Release 11i the version is 6i, so you will need a higher version of Oracle Reports available somewhere on your system.

To get the Oracle Report in XML format from rdf format, either use Oracle Report Designer or Oracle Report rwconverter.exe utility under $ORACLE_HOME/bin

Example
D:\Oracle_home\BIN>rwconverter batch=yes source= h:\reports\brvac.rdf dest= h:\reports\brvac.xml dtype=xmlfile overwrite=yes

This will convert the binary RDF file into an RDF-XML format that can then be consumed by the conversion APIs.

This looks confusing isn't it.
What are the exact steps involved that we need to perform?

1.Data Model Migration


Use DataTemplateGenerator API to migrate the Oracle Reports Data Model to a DataTemplate and associated PL/SQL logic to PL/SQL Package (specification and body).

The API can be called through the command line or through a shell script. This will generate following output files:
  • DataTemplate (REPORT.xml)
  • Default PL/SQL package specification (REPORTS.pls)
  • Default PL/SQL package body (REPORTB.pls)
Example :
javaw.exe oracle.apps.xdo.rdfparser.DataTemplateGenerator H:\report\brvac.xml

Output files:
  1. PL/SQL Package:H:\ report\brvacS.pls
  2. PL/SQL Body:H:\report\brvacB.pls
  3. DataTemplate:H:\report\brvac_template.xml
2. Layout Migration

Use RTFTemplateGenerator API to migrate the Oracle Reports layout to an XML Publisher RTF template.

Since there is no support of PL/SQL in RTF Template, the process does not migrate any format trigger logic present in the report. Instead the generator writes all the format trigger code to log file. You will need to implement any corresponding PL/SQL logic as XSL code. The majority of Oracle Reports use simple ‘if’ formatting logic that can be converted relatively easily. To aid in this process, the resulting RTF template will contain formfields that hold the format trigger names that are called, these fields will be highlighted in red. You can then refer to the log to find the actual PL/SQL code used in the original Oracle Report.

The API can be called through the command line or through a shell script. This will generate following output files:
  • RTF Template
  • Log file
Example :
javaw.exe oracle.apps.xdo.rdfparser.RTFTemplateGenerator H:\report\brvac.xml

Output files:
  1. RTF Template: H:\ report\ brvac.rtf
  2. Log File : H:\report\brvac.log
Does that mean, these two steps exactly converts the RDF to the required XMLP report without hassles?

No, its not really that simple though it is not tough either. There are some open issues that we need to take care of. Here are they:

Known Issues:
  1. Some times, because of complexity of Oracle Report the, Data Template or PL/SQL has some minor errors and requires manual correction.
  2. Format triggers are not supported. The format trigger logic should be implemented separately though XSLT
  3. If formula column reference the summary column as parameter and the summary column belongs to same Data Source/Data Query, this implementation is not supported in Data Template. This is because of all the formula columns moved to select statement and the summary column value is not available while executing the formula.
So can we have a complete example with sample data definition and template files?
Surely, we can have a complete example with required data definition and template file.
But not today or else I would be breaching the confidentiality agreement of my company. Because as of now I only have the reports on which I have worked as a part of the project. These are company exclusive. Very shortly, I shall create a rather simple report easy to understand for beginners and not related to the company I am working for. Then I shall upload the sample data definition and template files with all required screenshots and outputs.

Till then, bye bye and have a nice day.

Wednesday, May 7, 2008

Adventures

Life is full of strange surprises , some pleasant, some adventurous , some wild. And then there are people who are not satisfied with the adventurous experiences that life offers and want to add extra adventure to their lives. To some extent its fun. But again, there are people who are not satisfied unless they try the extreme and that is what this story revolves around.

Read On...

Life's Adventures Vs Adventurer's Life

Saleem, his wife Mehtaab and their little son Mubarak lived in a small hut very close to the sea shore in Orissa. By profession, Saleem was a fisherman who used to go out every morning rowing his boat into the mid sea and return in the evenings with as many fishes as he could manage. They could not afford a luxurious life but were happy with whatever they had.

Little Mubaarak was only 2 years old and the couple spent most of its time planning for Mubaarak's future. They used to save each penny of their earnings for Mubaarak. Saleem and Mehtaab were illiterate but they wanted to educate their only son and wanted him to become a doctor. Parents often want to see their children fulfilling their own dreams. Saleem's father was also a fisherman but he died after being stung by a poisonous aquatic creature. The poison was not very strong and he could have been saved only if their village had a doctor. But the nearest hospital was at a distance which had to be covered over a minimum of 5 hours in the locally available public transport. His father could not fight death that long and passed away on the way to the hospital. Since then, Saleem dreamt of making his son a doctor and Mehtaab supported him too. They used to sacrifice every small and big pleasure of their life and save money and they had been doing this since they got married. So the plans, expectations and dreams were all set for Mubaarak even before he came to his earthly existence.

Mubaarak, right from his birth, was a very naughty child. He had a tendency to do the forbidden.
He would try to reach things that were intensionally kept beyond his reach, he would try to taste things that he was not supposed to, he would try to do things that he knew his parents would not allow him to do. As he grew up, his interest towards things which commonly people would avoid, grew more and more intense.

Being born to a fisherman's family, he was an expert swimmer. Once he heard some villagers discussing that there was this cursed well into which many had fallen and died and that it has now been guarded by an iron wire so that no one can get too close. He immediately knew what he had to do next. He informed all his friends and acqaintances that he was going to jump into the well and come out of it that night. Every body tried to convince him not to do so but he was not one of those who would try to listen and understand what others say. He wanted to be the hero of the village and so he did what he had decided. As soon as his parents went off to sleep, he slipped out of his blanket and managed to come out of the house hiding in the darkness. He reached the place where the well was and he could see all his friends had accumulated to see his so called bravery. He crossed the iron wire and turned towards his friends one last time before jumping into the death well. Then he turned towards the well, closed his eyes and prayed to God. He was also afraid within, but the thought of becoming a hero in the village was so strong that it overcame his fear and there he was, all set to jump into the well. Ready, Steady an GO and splash came a sound from inside the well. All his friends of his age, 10-12 years, immediately ran from the place to inform the villagers. Within minutes the whole village was there standing beside the well and trying to pull him out. His unfortunate parents were also there. Saleem was almost ready to jump into the well himself to either save his son or die himself. Mehtaab was crying her heart out. They could not see their only son, their dream, their expectations, their life , their hope , everything drowning into the well. Just then they heard a noise from inside the well. They held the lantern to throw some light into the well so as to see what it was and they could see the smiling face of Mubaarak, fully drenched, climbing up the walls of the well. People tried to help him out with ropes and buckets but he didnot accept any help lest his bravery would not get all credit he thought he deserved for this action of his.

Finally, he was out of the well, standing there with his head held high in pride and satisfaction for having accomplished something he thought so great. And there right in front of him , was his father Saleem and mother Mehtaab, scared to death for the fear of losing their only son and the only ray of hope in their lives for whom they have been sacrificing every bit of thing they could to bring him up in the best possible way. But Mubaarak was so overwhelmed by his accomplishment that he didn't even realise what hell his perents went through in the last couple of minutes. He achieved what he wanted. All his friends thought he was the hero of the village. They began to look upto him as if he was their God. Mubaarak enjoyed all this attention and importance and kept doing such things which everyone else was either afraid to do or not allowed to do. This nature of his became stronger and stronger with time and by the time he was a 16 years old boy studying in the city high school, about 35 kms away from his village, inviting adventures became a habit he could not resist.

As soon as, he joined the city high school, he was eager to stay in Hostel. He gave several excuses to his poor illiterate parents like he would be able to do joint study and would be able to access the school library even at night. His parents also thought that travelling to school up and down everyday, laeves him too tired to study, so its better for his carrer to move to the school hostel. Though the hostel fees was much more than what any fisherman like Saleem could afford , but all their savings of their lives helped them accomodate the extra costs. They were ready to do anything to get their son the best possible education they could afford.

Thus, Mubaarak started staying in the hostel and used to visit home only in the weekends.

One weekend, he informed his parents that he was going on an excursion and would not be able to come home. He had lied. He was going out with his friends to satisfy his hunger for adventure.
The Weather guys had informed a day earlier that there is a threat of cyclone in the mid sea and that all fishermen and sailors should avoid the sea for the day. That's when Mubaarak decided to conquer the sea. He and his friends went to the shore that was closest to the city. They managed a boat somehow and then they were all set to sail. At the last moment , one by one all of Mubaarak's friends backed out. Mubaarak hated such show of fear and cowardice. He got angry and decided to sail all alone. His friends tried to convince him against going into the sea but Mubaarak had a hitler's mind. Once decided, he would not and he could not back out.

He sat on the boat, cut the rope and started rowing. He looked behind just once to say goood bye to his friends and made a mockery of them for they were scared of the cyclone whereas he was not. His friends only kept praying for him and kept shouting for him to come back. They were calling him as long as he was visible. But the mighty waves of the cyclonic sea took him out of sight pretty soon.

Mubaarak's friends waited for him to come back till the evening but as it grew dark and the waves went higher and higher, they came back to their school. Till late night when Mubaarak didn't return, they decided to inform the school authorities and his parents and so they did. By the time Saleem got the news, it was early morning of the next day. He immediately rushed towards his boat to get it ready to sail through the sea and search for his son. Mehtaab tried to stop him many times, but he was a mad man then. He could think nothing. He only knew that his son was in trouble and he had to save him. He went out into the sea. Mehtaab was waiting in the shore all day, without food without water awaiting her husband and son. In the evening she could see her husband returning. She outstreched her hands in anticipation of her son too. But as Saleem's boat came closer , she realized that Saleem was alone. Upon reaching the shore, Saleem could not utter a word. He only hugged Mehtaab tightly and broke down into tears. Mehtaab knew her son was lost in the sea and perhaps would never come back again. Even if he survives the untamed sea and the cyclone, he would not survive the hunger and the thrist , and even if he manages to survive that, he would probably serve as the fishes' food. With Mubaarak, all their hopes, their dreams, their expectations, their only reason for survival was lost. The cost of Mubaarak's adventure invitations was paid by Saleem and Mehtaab who were left behind to grow old without anyone to support them and nothing to look forward to.

Many years later, a tourist family had come to visit the fishing shore in Orissa and there was a young boy in the family. The boy was very excited to see such a huge endless water body. He was trying to break free of his mother's hold and rush towards the sea. An old man with wrinkled face and torn clothes was sitting nearby observing the boy. He stood up with great difficulty because of his old age and body ache and went close to the boy. The boy was a little scared to see him at first and so was his mother. The old man gently kept his hand on the boy's head and said, " Life is already full of adventures, you do not need to invite them.". Just then , an equally old lady came shouting " Saleem! Saleem!, Where are you? " . "Here I am, Mehtaab" , said the old man and walked away. The little boy and his mother kept staring at the old man as he limped his way towards the old lady standing at a distance, wrapped in a black shawl. Saleem's dry eyes and shaky voice had told them a story they were still trying to comprehend.
 
Free Hit Counters