APPS TO FUSION

.......Our Journey from Apps To Fusion

Click here to Receive Email
For New Articles


Prabhakar Somanathan

Integrating XML Publisher and OA Framework

User Rating: 4 / 5

Star activeStar activeStar activeStar activeStar inactive
 

The oracle applications is continuously evolving with the use of new technologies.
It is shifting from a traditional form based application to a self service web based application using Oracle Applications Framework (OAF) .
Every application requires a seamless integration with the reporting tools.
OA Framework seamlessly integrates with XML Publisher to fulfill the Oracle Applications reporting requirement.
In this article we will discuss in detail the integration of OA Framework and XML Publisher with an example.

It is assumed that the reader has basic understanding of OA Framework and XML Publisher.

The article has the following section
1) XML Publisher Architecture
2) Designing the OAF BC4J Data Model.
3) Designing the OAF Page and generating the Data XML
4) Designing the RTF Template using Data XML
5) Registering the Template with Oracle Applications.
6) Integrating the OAF page With XML Publisher.
7) Invoking the report from OAF

Step 1 : XML Publisher Reporting Architecture



An XML publisher report consist of a report template designed in RTF or PDF Formatand a Data XML file. The template contains the report layout. During execution the Data XML File is merged with the template to generate a PDF, HTML, EXCEL or RTF report.
Step 2: Designing the OAF BC4J Data Model.
Using jdeveloper create a ViewObject EmpVO using the below query and associate it to ApplicationModule EmpAM.

SELECT empno,ename,job,mgr,hiredate,comm,deptno FROM emp

The Jdevloper should look like this


Step 3 : Generating the XML for Template Design
Design a OAF Page EmpPG with the Following Code in the Controller EmpCO.

EmpCO :

public void processRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processRequest(pageContext, webBean);
OAApplicationModuleImpl am= (OAApplicationModuleImpl)pageContext.getApplicationModule(webBean);
am.invokeMethod("initEmpVO");
am.invokeMethod("getEmpDataXML");
}
EmpAMImpl :

public void initEmpVO()
{
EmpVOImpl vo = getEmpVO1();
if(vo == null)
{
MessageToken errTokens[] = {
new MessageToken("OBJECT_NAME", "EmpVO1")
};
throw new OAException("AK", "FWK_TBX_OBJECT_NOT_FOUND", errTokens);
} else
{
vo.executeQuery();
}
}
public void getEmpDataXML()
{
try {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
OAViewObject vo = (OAViewObject)findViewObject("EmpVO1");
((XMLNode) vo.writeXML(4, XMLInterface.XML_OPT_ALL_ROWS)).print(outputStream);
System.out.println(outputStream.toString());
}
catch(Exception e)
{
throw new OAException (e.getMessage());
}
}
On running the page , the data xml file will be printed on the Jdeveloper Embeded OC4J Sever Log (since i have used System.out.println). The XML file will be like
<EmpVO>
<EmpVORow>
<Empno>7369</Empno>
<Ename>SMITH</Ename>
<Job>CLERK</Job>
<Mgr>7902</Mgr>
<Hiredate>1980-12-17</Hiredate>
<Deptno>20</Deptno>
</EmpVORow>
<EmpVORow>
<Empno>7499</Empno>
<Ename>ALLEN</Ename>
<Job>SALESMAN</Job>
<Mgr>7698</Mgr>
<Hiredate>1981-02-20</Hiredate>
<Comm>300</Comm>
<Deptno>30</Deptno>
</EmpVORow>
<EmpVORow>
<Empno>7521</Empno>
<Ename>WARD</Ename>
<Job>SALESMAN</Job>
<Mgr>7698</Mgr>
<Hiredate>1981-02-22</Hiredate>
<Comm>500</Comm>
<Deptno>30</Deptno>
</EmpVORow>
</EmpVO>
Step 4 : Designing the Template

Install the Oracle XML Publisher Desktop available via patch 5887917. Open the Microsoft word. You should be able to see the following menus and toolbars.
Using the menu Data -> Load XML Data... , load the XML File generated from Jdeveloper
If the XML files gets loaded successfully, then you should get the below confirmation.


Using the Table Wizard as below to create the 'Table Report Format' with all the columns of EMP.
The Table Report Format Template should be like
Save the document as Emp.rtf. Preview the report as PDF, XML, HTMl or RTF.
Step 5 : Registering the Template with Oracle Applications.
Login with a user having "XML Publisher Administrator" Responsibility.Navigate to Home --> Data Definition and define the data definition.

Navigate to Home --> Template and Define the Template
Step 7 : Integrating the OAF page With XML Publisher
Design the EmpPG page to appear as shown below.



Set the Action Type and Event property of the Tourch Image Item to FireAction and GenerateReport respectively. Modify the Controller and ApplicationModule as below

Imports :
import oracle.xml.parser.v2.XMLNode;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import oracle.apps.xdo.XDOException;
import oracle.apps.xdo.oa.schema.server.TemplateHelper;
import oracle.cabo.ui.data.DataObject;
import oracle.jbo.XMLInterface;

EmpCO :
private static final int DEPTH = 4;
private static final int APP_ID = 20035;
private static final String APP_NAME = "XXIGS";
private static final String TEMPLATE_CODE = "Emp_Template";
private static final int BUFFER_SIZE = 32000;

public void processRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processRequest(pageContext, webBean);
OAApplicationModuleImpl am= (OAApplicationModuleImpl)pageContext.getApplicationModule(webBean);
am.invokeMethod("initEmpVO");
}
public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processFormRequest(pageContext, webBean);
OAApplicationModuleImpl am= (OAApplicationModuleImpl)pageContext.getApplicationModule(webBean);

String event = pageContext.getParameter("event");
if("GenerateReport".equals(event))
{

// Get the HttpServletResponse object from the PageContext. The report output is written to HttpServletResponse.
DataObject sessionDictionary = (DataObject)pageContext.getNamedDataObject("_SessionParameters");
HttpServletResponse response = (HttpServletResponse)sessionDictionary.selectValue(null,"HttpServletResponse");
try {
ServletOutputStream os = response.getOutputStream();

// Set the Output Report File Name and Content Type
String contentDisposition = "attachment;filename=EmpReport.pdf";
response.setHeader("Content-Disposition",contentDisposition);
response.setContentType("application/pdf");

// Get the Data XML File as the XMLNode
XMLNode xmlNode = (XMLNode) am.invokeMethod("getEmpDataXML");
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
xmlNode.print(outputStream);
ByteArrayInputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
ByteArrayOutputStream pdfFile = new ByteArrayOutputStream();

//Generate the PDF Report.
TemplateHelper.processTemplate(
((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransaction()).getAppsContext(),
APP_NAME,
TEMPLATE_CODE,
((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransaction()).getUserLocale().getLanguage(),
((OADBTransactionImpl)pageContext.getApplicationModule(webBean).getOADBTransaction()).getUserLocale().getCountry(),
inputStream,
TemplateHelper.OUTPUT_TYPE_PDF,
null,
pdfFile);

// Write the PDF Report to the HttpServletResponse object and flush.
byte[] b = pdfFile.toByteArray();
response.setContentLength(b.length);
os.write(b, 0, b.length);
os.flush();
os.close();
}
catch(Exception e)
{
response.setContentType("text/html");
throw new OAException(e.getMessage(), OAException.ERROR);
}
pageContext.setDocumentRendered(false);
}

EMpAMImpl :

public void initEmpVO()
{
EmpVOImpl vo = getEmpVO1();
if(vo == null)
{
MessageToken errTokens[] = {
new MessageToken("OBJECT_NAME", "EmpVO1")
};
throw new OAException("AK", "FWK_TBX_OBJECT_NOT_FOUND", errTokens);
} else
{
vo.executeQuery();
}
}
public XMLNode getEmpDataXML()
{
OAViewObject vo = (OAViewObject)findViewObject("EmpVO1");
XMLNode xmlNode = (XMLNode) vo.writeXML(4, XMLInterface.XML_OPT_ALL_ROWS);
return xmlNode;
}


Run the EmpPG page and click on the tourch icon. The File Download window appear. Click on the Open Button to view the report.


.[

Comments   

0 #1 kishore Ryali 2008-05-11 10:43
Hi Prabhakar
Good Article. I believe we can levarage this approach to view the output of XMLP report with the user desired output format like Excel/HTML/PDF.
By providing a LOV to select the output format and change the PFR to set that output to TemplateHelper. processTemplate

Using this approach we can overcome the restriction to default output (PDF) from SRS.

Thanks for sharing.
Quote
0 #2 Ritu 2008-05-11 12:25
Hi

Awesome article. I had been requesting Anil to publish something on this integration for a long time.
Did you not leverage the XDOCommonRN in your integration?

T his one is actually a better way I think, it provides more flexibility.

R itu
Quote
0 #3 Anil Passi 2008-05-11 13:50
Hi Ritu

Indeed you and others requested this in past.
But given that I myself had learnt this technique from Prabhakar, I wanted Prabhakar to publish this himelf.

For those who don't know, when Prabhakar was in Oracle Corp, he had developed various complicated XMLP reports that could be invoked from OAF in realtime.

Chee rs,
Anil Passi
Quote
0 #4 Prabhakar Somanathan 2008-05-14 17:07
kishore , you are correct. We can have a message choice for the output format. Based on the selected output type , we can generate the report.

Ritu, XDO Common region in my understanding should be used when one want to give the end user some data filtering options. Like you can have two regions.

Region 1 :
A search Region where u can have UI components to enter the search criteria

Region 2:
XDO Common region where you display the report. The report data will be based on the search criteria

If one wants to get the content of a page say invoice page into a report, then he can use the logic shown in the article.

I will shortly publish a article for the XDO Common Region

Thanks
Prabhakar.S
Quote
0 #5 Rishi 2008-06-16 16:51
when I am trying to compile the above code in EMP CO I am getting the following error : variable TemplateHelper not found in classs
Quote
0 #6 Prabhakar Somanathan 2008-06-16 18:02
Hi Rishi,
Import the class oracle.apps.xdo .oa.schema.serv er.TemplateHelp er in the controller. This will be available in $JAVA_TOP/oracl e/apps/xdo/oa/s chema/server. I would advise you to copy the xdo directry from the $JAVA_TOP and create a zip file and add it to the Project Libraries.

Tha nks,
Prabhakar. S
Quote
0 #7 Rakes.jain@gmail.com 2008-07-08 21:20
"This will be available in $JAVA_TOP/oracl e/apps/xdo/oa/s chema/server. I would advise you to copy the xdo directry from the $JAVA_TOP and create a zip file and add it to the Project Libraries."

pl s Explain it step by step ?
and
iam not able to run this xdo page from Jdeveloper itslelf.
can you help me out to achieve that ?
Quote
0 #8 Dev 2008-07-23 04:58
Hi Prabhakar/ Anil,

I want to create a pdf template instead of rtf template for my report, and make some fields as editable.
The generated pdf output should have some fields as editable which anyone can fill and save through adobe reader.
I tried creating such pdf template through adobe acrobat but facing issues. When I create a template through xml publisher admin responsibility and attach my template, it errors out. Also, if I create a rtf template with pdf form fields in it, it generate a static pdf output.

Any help is greatly appreciated.

T hanks,
Dev
Quote
0 #9 jyo 2008-08-12 17:14
I did all the above listed steps . I get prompted to open/save the pdf file . I click on Open, gives me the follwoing error :
'could not open because it either not a supported file or because the file has been damaged(for example , it was sent as an email attachement and wasnt correctly decoded)'

Woul d be glad if you help me debug this error message.
Thanks
Jyo
Quote
0 #10 jyo 2008-08-12 17:23
I forgot to mention one more thing above :
I did all the above listed steps .
I made it in ak module so i changed private static final int APP_ID = 601;

I get prompted to open/save the pdf file . I click on Open, gives me the follwoing error :
'could not open because it either not a supported file or because the file has been damaged(for example , it was sent as an email attachement and wasnt correctly decoded)'

Would be glad if you help me debug this error message.
Thanks
Jyo
Quote
0 #11 Danny Parrish 2008-10-14 19:24
Prabhakar,

The step where you are getting your XML Data source, would it be possible to define another data source for it that is now part of the page definition? (For example, a Concurrent Request where the output is in XML). Thanks, Danny
Quote
0 #12 Barozkok 2008-10-27 12:11
Hi Prabhakar,
I try to call a report with data. When I use template and data in English there is no problem. But Template in Turkish containing some characters different from Engilish I can see only the empty template. What can be the reason?
Thsnks.
Quote
0 #13 Suresh1784 2008-10-27 13:36
Even I am getting the Error!!!!!!!!

when I try open the PDF file

could not open because it either not a supported file or because the file has been damaged(for example , it was sent as an email attachement and wasnt correctly decoded

Please advice what shoud I do?

Thanks
Sur esh
Quote
0 #14 Barozkok 2008-10-29 09:06
Hi,
If the template needs two different queries(some fields in report may be repeated), how can I combine two xml data produced by different queries(diifere nt view objects)?
Thank s in advance.
Quote
0 #15 Dean 2008-11-19 04:36
Hi Prabhakar,

Eve n I am getting the same error as some above

when I try open the PDF file

could not open because it either not a supported file or because the file has been damaged(for example , it was sent as an email attachement and wasnt correctly decoded

Please advice what shoud I do?

Thanks,
Dean
Quote
0 #16 kishor nagbhire 2008-12-09 06:21
hi SHIVA
i'm a new user of ur site
can u help me on that topic
i want record in GL

'''''' undefined accounting periods in the current accounting calendar '''''''''''

help me
thanks
Quote
0 #17 Sreeramvaskuri 2009-01-05 00:27
This article is very good.easily understanding the developer.in that entire code,i didnt understand the below mentioned.
What exactly use of this code and where do i get a sessionParamete rs for assigning to this.
Is it automatically populated,or we have to write some code for this.
Could you please advice me.how to get these values.
// Get the HttpServletResp onse object from the PageContext. The report output is written to HttpServletResp onse.
DataObject sessionDictiona ry = (DataObject)pageContext.getNamedDataObject("_SessionParameters");
HttpServletResp onse response = (HttpServletResp onse)sessionDictiona ry.selectValue(null,"HttpServletResp onse");
Quote
0 #18 PrathapReddy K 2009-01-06 02:31
Hi Prabhakar,

I am also getting the same error as "not a supported file or file has been damaged".

when I try open the PDF file

could not open because it either not a supported file or because the file has been damaged(for example , it was sent as an email attachement and wasnt correctly decoded

Please advice what to do?

Regards--
Pra thapreddy.
Quote
0 #19 PrathapReddy K 2009-01-06 03:40
Hi Prabhakar,

for the same code I tried to generate HTML type report.
it is showing the below mentioned error message and query

No corresponding LOB data found :SELECT L.FILE_DATA FILE_DATA,DBMS_ LOB.GETLENGTH(L .FILE_DATA) FILE_LENGTH, L.LANGUAGE LANGUAGE, L.TERRITORY TERRITORY, B.DEFAULT_LANGU AGE DEFAULT_LANGUAG E, B.DEFAULT_TERRI TORY DEFAULT_TERRITO RY,B.TEMPLATE_T YPE_CODE TEMPLATE_TYPE_C ODE, B.USE_ALIAS_TAB LE USE_ALIAS_TABLE , B.START_DATE START_DATE, B.END_DATE END_DATE, B.TEMPLATE_STAT US TEMPLATE_STATUS , B.USE_ALIAS_TAB LE USE_ALIAS_TABLE , B.DS_APP_SHORT_ NAME DS_APP_SHORT_NA ME, B.DATA_SOURCE_C ODE DATA_SOURCE_COD E, L.LOB_TYPE LOB_TYPE FROM XDO_LOBS L, XDO_TEMPLATES_B B WHERE L.APPLICATION_S HORT_NAME= :1 AND L.LOB_CODE = :2 AND L.APPLICATION_S HORT_NAME = B.APPLICATION_S HORT_NAME AND L.LOB_CODE = B.TEMPLATE_CODE AND (L.LOB_TYPE = 'TEMPLATE' OR L.LOB_TYPE = 'MLS_TEMPLATE') AND ( (L.LANGUAGE = :3 AND L.TERRITORY = :4) OR (L.LANGUAGE = :5 AND L.TERRITORY = :6) OR (L.LANGUAGE= B.DEFAULT_LANGU AGE AND L.TERRITORY= B.DEFAULT_TERRI TORY ))

Also I have a Doubt that where we are assigning the data to the "pdfFile"?

Regards--
P rathapReddy
Quote
0 #20 Sreeramvaskuri 2009-01-06 06:35
Hi ,

I am tried to generate a .Pdf file.It is generating,but without data.
could you please help me out,where i am wrong.

Thanks & Regards
Sreeram a Vaskuri
Quote
0 #21 PrathapReddy K 2009-01-06 08:05
Hi Prabhakar,
I found some sample to call the concurrent programm in the OAF Page.
I have some doubts, below is the details.


When I try to call the Concurrent program from my controller class it is showing the following error message

oracle.apps.fnd.cp.request.RequestSubmissionException: Cannot submit concurrent request for program POSReport
below is t code I used to call the Concurrent program.

OAException oaexception1 = null;
Number number = 123;
OADBTransaction oadbtransaction = am.getOADBTrans action();
Vector vector = new Vector();
vector.addEleme nt(String.value Of(number));
try
{

ConcurrentReque st concurrentreque st = new ConcurrentReque st(oadbtransaction.getJdbcConnection());
int i = concurrentreque st.submitRequest("AK", "POSReport", "", null, false, vector);
oadbtransaction .commit();

It is exactly giving the error at the calling of the *concurrentreque st.submitRequest*

Pls advise me how to overcome this.
Also where can we find the JavaDoc for all these classes?
Also will it shows the report of the concurrent request after execution?
Im trying to run this to generate a report.
I have registered the report In the Apps.
I want to call that report in the OAF page.

Regards--
Pra thapReddy
Quote
0 #22 Eric Smith 2009-01-09 11:22
I am getting the same issue as many above, where the PDF will not open. I changed the content-type to application/tex t and TemplateHelper. OUTPUT_TYPE_PDF to OUTPUT_TYPE_TEX T. After inspecting the data sent back, it appears to be the HTML of the OAF Page generated. Is there a specific version of jdev we should be using?
Quote
0 #23 Talluri Ajay 2009-01-24 07:11
Hi
I am trying to initantiate a Datatemplate using oracle.apps.xdo .oa.util.Datate mplate for a Data Definition that I have defined earlier.

Later I have imported xdo directory and included it in the library (using Project settings). Then I was getting an error for oracle.apps.fnd .i18n
I have imported the same onto my system and included in the library .

Now I am getting an error saying java.lang.NoSuc hMethodError, msg=oracle.apps .fnd.i18n.commo n.text.resource s.CalendarResou rceAccessor.get EraResources()

What could be the reason for this error.
And apart from the xdo package what other libraries should we import
Quote
0 #24 Somasekhar 2009-01-26 23:34
Hi,

At present i am wokring EAM Module. Here i need to call one XML Publisher report.
In my OAF Page one button is there. After clicking this button i need to fire one report(The name of the report is "Maintenance Picking Slip Issued Report").

Please help me how to call report? I don't have any idea how to proceed for this.please explain clearly.


Than ks in advance..

Than ks,
Somasekhar.


Thnaks,
Soma sekhar
Quote
0 #25 PrathapReddy K 2009-01-28 05:30
Hi Anil,
The PDF report is openiing perfectly.
The problem is we need to add all the fnd and xdo classes in the classes folder when we are trying with JDeveloper, then it is working fine.

Now my question is can we able to open the PDF Report directly, instead it prompts us for save or open options.

I think this can be done by modifying the parameters for TemplateHelper. processTemplate method.
I tried and I am unable to get it. Can you help me regarding this.


Regards --
PrathapReddy
Quote
0 #26 chanu 2009-03-16 07:31
Hi,

How will we print output in XML from OAF page.

As i cant get the OAF files from the server, what should i do to get output in XML from instance as u said "System.out.pri ntln".

I have Access to XML publisher administrator can i do anything there??\

Regra rds,
Chanu
Quote
0 #27 Caleb Heidebrechtt 2009-03-27 14:26
I looked through your blog for some basic information on importing FSG output into BI Publisher Enterprise. I didn't see anythign that basic and I am wondering if you have any advice and or links to blogs that could explain this process for me. I am just beginning with this. Thanks for any help you can offer.
Quote
0 #28 GsrC 2009-04-03 15:46
Hi;

I am able to prepare a xml publisher PDF report with single VO(select query) with the help of above steps where as in my requirement I required to write more then one VO(select querys). Can you give some ideas how to proceed?

--
Gs rC
Quote
0 #29 rkumar1836 2009-05-06 06:29
Like many Others i am too getting the error when opening the pdf file
have anyone found the specific reason for this.
Quote
0 #30 Anitha.veerappa 2009-05-14 06:45
I was also getting the file open error "adobe reader could not open the file because it is not a supported file type".

I uninstalled the Adobe reader, then the page showed me the real reason why it was not working. I was getting the error because I had written the method "getEmpDataXML" in the controller and was trying to call it from AM just like how the code here is doing. Once I got the exact error, I fixed the error and installed adobe reader and issue was resolved!
Quote
0 #31 Anitha.veerappa 2009-05-14 07:23
Hi All,

I have a custom xml publisher report already developed which is being run from the SR window. Now the client requirement is to call the same xml publisher from a self service page. The existing code is a PL/SQL code which queries and generates the xml tags for a appraisal_id (Primary key for the whole data) that is passed. Is there a way to reuse the same code, that is create callable statement and execute that procedure to get the xml data. What are the classes that are to be used to get such data from the procedure and convert it to XMLNode in the controller of the page?
Quote
0 #32 Setu 2009-05-26 11:11
Hi,
Excellent article !!!

I have an query regarding the above test program. I tried following steps as detailed above and am stuck at Step 5

Step 5:
Code = EmpDataDefiniti on

Is "EmpDataDefiniti on" a concurrent program or VO name ? If not a concurrent program where to deploy it and how to register it ?

My goal to try to use OAF-VO instead of rdf reports for data-model in XMLP. Can this be done ?

Cheers,
Setu
Quote
0 #33 new_member 2009-06-02 12:01
Hi Prabhakar Somanathan,
I am new in OAF. I am trying create OAF to call xml publisher.
Coud l you send to me all source of steps above.

Many thanks for your helps
Quote
0 #34 Dupo 2009-07-09 08:21
Hi,
Is there a way in OA Framework such that when the user clicks a link,a pdf file contaning the output of report or concurrent program should get fired. The pdf file path will be stored in unix and can find out the path from a table.

Any suggestions....
Please help me out
Quote
0 #35 rohit15v 2009-07-10 15:02
Hi Prabhakar,

Even I am getting the same error as some above

when I try open the PDF file

could not open because it either not a supported file or because the file has been damaged(for example , it was sent as an email attachement and wasnt correctly decoded

Please advice it's very urgent.
if any one got solution plz send me my mail id:
Quote
0 #36 rohit15v 2009-07-10 15:07
please reply.. it's very urgent for me....
Quote
0 #37 Hieu 2009-07-15 04:25
Hi Prabhakar,

Eve n I am getting the same error as some above. When I try to open the pdf file "could not open because it either not a supported file oor because file has been damaged..."
Ple ase advice, it is very urgent. If you have any solution, please send me through email:
Quote
0 #38 Periyasamy Rajamanickam 2009-08-05 06:43
A Similar Solution,
Doc ID: 429990.1 How to Submit a Concurrent Request Using a Self-Service Page
Quote
0 #39 Periyasamy Rajamanickam 2009-08-05 07:04
A Similar Solution, Directly Calling the report from 11i Self Service Menu
Doc ID: 334847.1
Subjec t:How to add a report to a 11i Self Service Menu

One More Way,
It seems to Submit Active Users, we can add a button(Create a New Item) to a any page using personalization and call FNDCPPROGRAMPAG E,
Destination URI: OA.jsp?akRegion Code=FNDCPPROGR AMPAGE&akRegion ApplicationId=0 &programApplNam e=FND&programNa me=FNDSCURS
Pro mpt: Active Users Report
Quote
0 #40 Venkatd 2009-08-31 14:48
Hi Prabhakar,

Tha nks for such a nice article. We have followed this and worked on a prototype of a project and everything worked fine. We then enhanced this to actual project, which is based based two queries (master/detail) . It is producing two independent xml documents. What we need is root elements which includes these two xml documents. We tried to add two string variables and concatenate them to outputstreams but were unsuccessful (may be due our limited knowledge of the java classes).

Could you advise what we can do to get desired output? I request Prabhakar, Anil and all Jdeveloper experts in the forum to suggest what we can do and appreciate all your inputs.

Thanks ,
Venkat
Quote
0 #41 putchakayala 2009-12-24 01:39
Hi ,

I can able to generate the pdf file from one view object but in my case I have to generate the pdf file from multiple VOs .

can any one suggest me how to do?

thanx

Rama putchakayala
Quote
0 #42 khalifa 2009-12-28 04:20
I am also getting the same error as "not a supported file or file has been damaged".

when I try open the PDF file

could not open because it either not a supported file or because the file has been damaged(for example , it was sent as an email attachement and wasnt correctly decoded

Please advice what to do? or send it to my email

thx
khalifa
Quote
0 #43 khalifa 2009-12-28 04:31
my email is
Quote
0 #44 khalifa 2009-12-28 05:24
hi Prathap

i did wha you tell me but the i still got "could not open because it either not a supported file or because the file has been damaged " when the PDF file opens

i really don't know what to do

thx
khalifa
Quote
0 #45 heba 2009-12-29 07:07
hii all
can anyone help me i follow the previos steps and the PDF was generated but when i tried to open it an error message appear " file has been damaged"
althou gh i have XDO folder in my classes folder

did anyone solve this problem or it because version of jdeveloper
my email is

thx
heba
Quote
0 #46 khalifa 2010-01-03 06:34
hi;
i want to know if i can use the previous code to generate report based on multipule view objects meaning that the report will be in form of master detail
or is there any other way to do that ??
my email is

thx
khalifa
Quote
+1 #47 jyoti jain 2010-01-27 03:53
To resolve the problem of multiple vo's you have create your own cutom xml. A sample code is here for your help


public XMLNode getpayDataXML()
{
ByteArrayOutput Stream outputStream = new ByteArrayOutput Stream();

ByteArrayOutput Stream outputStream1 = new ByteArrayOutput Stream();



MainVOImpl mv = getMainVO1();

Leave_BalanceVO Impl lb = getLeave_Balanc eVO1();



XMLDocument doc = new XMLDocument();
Element root = doc.createEleme nt("root");
Element per= null;
Element sal= null;
Element deduction= null;
Element tpay = null;
Element tded = null;
Element total = null;

Element days_present = null;
Element leave_balance = null;

Double paym = 0.0;
Double ded = 0.0;

Element dummy = null;


mv.executeQuery ();
while(mv.hasNex t())
{
//System.out.pr intln("4");
per = doc.createEleme nt("PersonRow") ;
String ch = "";
Row p1= mv.next();
String s[] = p1.getAttribute Names();
int c = p1.getAttribute Count();
//System.out.pr intln("Count =" + c);
for (int i=0;i
Quote
0 #48 jyoti jain 2010-01-27 03:55
for (int i=0;i
Quote
0 #49 jyoti jain 2010-01-27 03:56
sorry freinds I am unable to add the code. Is is not getting updated in the site
Quote
0 #50 Ambika 2010-02-18 19:31
Hi,

I have an RDF Report which generates the XML data and XML template registered in BI publisher.

Req uirement is to fire the custom existing report instead of standard report.

The standard controller seems to generate XML and generate OA framework report as shown in your example.

But I want to extend the existing controller / overwrite the standard to call my custom report.

Can you tell me how to do this?
Quote
0 #51 Raj Dutta 2010-04-01 05:18
Hi Prabhakar, your article helped me very much to learn how to generate XML data from single VO. Can you please post how to create XML data from multiple VOs.
Thanks & Regards
Raj
Quote
0 #52 Gana 2010-06-20 04:54
could not open because it either not a supported file or because the file has been damaged " when the PDF file opens .

Please guide in this case. Have been sturggling with this error for almost 4 days..
Quote
0 #53 narne 2010-07-12 13:50
Hi

I need to call a concurrent program using OAF personalization . I got this working fine but I need to know how to pass parameter values to the concurrent program. Please suggest a way to do this.

Regards,
Girish.
Quote
0 #54 Steve 2010-08-12 18:39
Thank you for the great sample code. I am able to open, save my pdf file after clicking on a button on page, but the problem is that when I closed the pdf window, my other buttons on the base form do not work, I got a message of "You cannot complete this task because you accessed this page using the browser's navigation buttons (the browser Back button, for example)." Have you seen this kind of error before. Thank you in advance. Steve
Quote
0 #55 Ashihs Raj 2010-08-15 13:42
I assume, You are calling some thing similar to folling statement. params is the Vactor, you can pass all the value as vector. make sure you pass in the same sequence as defiend in CP definiton.

sub mitRequest("AP" , "APXSOBLX ", "Supplier Open Balance Letter", null, true, params); // arguments vector

Please check the Comments section og following Blog entery for futher details on the same question.

Subm itting BI Publisher Concurrent Program from PL/SQL

http://www.adivaconsulting.com/adiva-blog/item/8-bip_concurrent_program_plsql

-Raj
www.adivaconsulting.com
Quote
0 #56 Ashihs Raj 2010-08-15 13:48
Hi Dutta,
I assume, you want a master detail relationship between VOs. just add thechild VO as View Link and execute the Master VO. When you invoke the master VO to write the xmlNode and write file stream, It will write the xml for all viewlink as well.

-Raj
www.adivaconsulting.com
Quote
0 #57 Robert Jungerius 2010-10-11 10:36
The issue that the PDF is not readable, empty or damaged is because you run the page from within JDeveloper.
I got the same error and in the text that is dumped into the PDF (the PDF contains a complete dump of the error page it seems) i could see that it is because of the file path.
The file path in JDeveloper is built with windows "\" separator for the folders, while it should be the unix "/" off course.

After installing the page on the server everything worked fine for me.
Quote
0 #58 Dracis 2010-10-22 08:52
Thanks for the Article, really learning alot. Unfortunately, I (like many others) am getting the issue with the empty/damaged pdf. I am recieving the message both from within Jdeveloper and after deployment to our unix development box. I'm going to keep after it, because this undoubtedly will come in very handy in the future. I'll post back if I have success. If anyone else has figured it out, please post as well. Thanks !!
Quote
0 #59 Dracis 2010-10-25 07:39
OK.. here is how it started working for me. Hopefully, it might help someone else.

Instead of a PDF.. I set the output for html, so I could read the error message. Their was an error message "No corresponding LOB data.." BLAH BLAH. Come to find out, it could not find my template. Through some trial and error, I set the TEMPLATE_CODE = and the error message went away. Set it back to PDF.. and success... it is working beautifully.

Not sure why, I'm just a beginner in all this.
Quote
0 #60 musavi 2010-11-06 08:15
HI
How can i build xdo library from xdo directory on oaf server to my jdeveloper client
thanks
Quote
0 #61 Udeshika 2011-04-11 03:37
Hi ,

I am also getting this error

Error: file type is not supported or file is damaged

while trying this example.

Pleas e provide the solution for it,i have gone thorugh the comments above, tried to acchieve,but unable to suceed.

:(
Ple ase help!!
Quote
0 #62 Richa 2011-04-14 05:29
Hi

I am also getting the error as mentioned above. I am working on R12.
Please suggest something . I am not able to proceed further.

~Rich a
Quote
0 #63 MandarD 2011-07-27 05:30
Hi

My requirement is as below

I have a master page which has a simple search region.
For eq
If i query the master page it gives me 5 records
Clickin g on any of the records takes me to the details of that record.
I have a button which generates the PDF output for that detail record.
I want the functionality that when the user clicks the button the PDF output should directly be printed

Currently the user has to open the PDF output and then Click on the Print in PDF output to print the record

My next requirement is that to bring the PDF button(on the detail Page) to the master page so that on one click i should be able to Print all the PDF report records.

Pleas e help me with this
Thanks
Quote
0 #64 Rolland Charpentier 2011-09-23 10:01
Hi
Do you think it could be possible to bypass the pop up window "File download security Warning"
and go directly to the PDF file

Thanks
Quote
0 #65 srinivasa Telu 2011-12-21 17:21
Hi Prabhakar,

It was a nice a nice article, I have added few properties to make it work.
Now I have a big issues we have developed this XML report based on a view, but when I modify the view like adding a column or removing a column it is throwing some errors.

can you please suggest me what to do if VO objects base query that is based on VIEW modified?.

Tha nks in Advance.

Srini vas
Quote
0 #66 praveen sudhati 2012-01-25 02:32
if u getting the issue with the empty/damaged pdf


Then create the tmp folder in your local system where jdeveloper is installed.This will fix the issue.

suppose if ur jdeveloper is present in D drive ,then create the tmp folder in D drive.


It will fix the error.




Than ks,
Praveen Sudhati.
Quote
0 #67 Hande D 2012-02-01 03:28
Application module code :
public XMLNode[] getDataXML()
{ int r = 0;
XMLNode NodeList[] = new XMLNode[15];
try {
ByteArrayOutput Stream outputStream = new ByteArrayOutput Stream();
XxisbtYbnOzlukV OImpl vo = getXxisbtYbnOzl ukVO1();
XxisbtYbnTertay VOImpl tvo = getXxisbtYbnTer tayVO1();
XxisYbnEgitimVO Impl evo = getXxisYbnEgiti mVO1();
XxisHrYbnCezaBi lgileriVOImpl cvo = getXxisHrYbnCez aBilgileriVO1() ;
XxisbtYbnTumPer formansVOImpl pvo = getXxisbtYbnTum PerformansVO1() ;
TesekkurBilgile riVOImpl tevo = getTesekkurBilg ileriVO1();
YakinmaBilgiler iVOImpl yvo = getYakinmaBilgi leriVO1();
XxisYbnOdulBilg ileriVOImpl ovo = getXxisYbnOdulB ilgileriVO1();
XxisHrHyoToahVO Impl hvo = getXxisHrHyoToa hVO1();

NodeList[0] = (XMLNode)vo.wri teXML(4, XMLInterface.XM L_OPT_ALL_ROWS) ;
((XMLNode)vo.wri teXML(4, XMLInterface.XM L_OPT_ALL_ROWS) ).print(outputS tream);

if(tvo.first()! =null){
NodeList[1] = ((XMLNode)tvo.w riteXML(4, XMLInterface.XM L_OPT_ALL_ROWS) );
((XMLNode)tvo.w riteXML(4, XMLInterface.XM L_OPT_ALL_ROWS) ).print(outputS tream);
System.out.prin tln(outputStrea m.toString());
}
if(evo.first()! =null){
NodeList[2] = ((XMLNode)evo.w riteXML(4, XMLInterface.XM L_OPT_ALL_ROWS) );
((XMLNode)evo.w riteXML(4, XMLInterface.XM L_OPT_ALL_ROWS) ).print(outputS tream);
}
if(cvo.first()! =null){
NodeList[3] = ((XMLNode)cvo.w riteXML(4, XMLInterface.XM L_OPT_ALL_ROWS) );
((XMLNode)cvo.w riteXML(4, XMLInterface.XM L_OPT_ALL_ROWS) ).print(outputS tream);
}
if(pvo.first()! =null){
NodeList[4] = ((XMLNode)pvo.w riteXML(4, XMLInterface.XM L_OPT_ALL_ROWS) );
((XMLNode)pvo.w riteXML(4, XMLInterface.XM L_OPT_ALL_ROWS) ).print(outputS tream);
}
if(tevo.first() !=null){
NodeList[5] = ((XMLNode)tevo. writeXML(4, XMLInterface.XM L_OPT_ALL_ROWS) );
((XMLNode)tevo. writeXML(4, XMLInterface.XM L_OPT_ALL_ROWS) ).print(outputS tream);
}
if(yvo.first()! =null){
NodeList[6] = ((XMLNode)yvo.w riteXML(4, XMLInterface.XM L_OPT_ALL_ROWS) );
((XMLNode)yvo.w riteXML(4, XMLInterface.XM L_OPT_ALL_ROWS) ).print(outputS tream);
}
if(ovo.first()! =null){
NodeList[7] = ((XMLNode)ovo.w riteXML(4, XMLInterface.XM L_OPT_ALL_ROWS) );
((XMLNode)ovo.w riteXML(4, XMLInterface.XM L_OPT_ALL_ROWS) ).print(outputS tream);
}
if(hvo.first()! =null){
NodeList[8] = ((XMLNode)hvo.w riteXML(4, XMLInterface.XM L_OPT_ALL_ROWS) );
((XMLNode)hvo.w riteXML(4, XMLInterface.XM L_OPT_ALL_ROWS) ).print(outputS tream);
}


}
catch(Exception e)
{
throw new OAException (e.getMessage() );
}
return NodeList;

}

Controller:
byte buf[] = "".getBytes();
outputStream.wr ite(buf);

XMLNode Nodes[] = new XMLNode[10];
Nodes = AM.getDataXML() ;

for(int i = 0;i
Quote
0 #68 Hande D 2012-02-01 03:33
Controller:
byte buf[] = "".getBytes();
outputStream.wr ite(buf);

XMLNode Nodes[] = new XMLNode[10];
Nodes = AM.getDataXML() ;

for(int i = 0;i
Quote
0 #69 harinireddy 2012-02-09 00:59
hi
can u tell me the code to be written in the co file for go button if the requirement is like if we give the emplno in emp table then d whole details of that empno should be displayed
for eg if 7369 is typed and go button is pressed then the oputput must show all its details like ename,job,mgr etc
pzzz do help me
Quote
0 #70 Anonymous 2012-02-21 07:30
I too followed the steps listed on this page and was getting "not a supported file or file has been damaged" while opening the PDF until I read the steps carefully again. The reason for the failure was that I forgot to modify the method getEmpDataXML in AMImpl from "public void getEmpDataXML() " to "public XMLNode getEmpDataXML() " and modify method getEmpDataXML's code to return the xmlNode appropriately. Please refer to author's second version of the method on the page. That was merely a overlook, thinking that I already had the code in the AMImpl's method.

Anyway s, a big thanks to the author to help me learn the integration. Truly appreciate his effort and the site's initiative in making these kind of things available to developers like me.
Quote
0 #71 swap 2012-03-08 00:44
I have a requirement where I have to generate payslips through OFA.

Payslip report has 3-4 queries in it.

How to use those 3-4 queries so that I will get XML with groups in it
Quote
0 #72 donard 2012-04-11 05:03
Hi Prabhakar,

Tha nks for the wonderful guide.

I was able to successfully generate a PDF in my local machine. However, after deploying the changes in our Dev instance, the PDF generated in the Dev instance is corrupted.

The file size generated in my local is 100KB. In the Dev instance, the file is significantly less, about 65KB only.

Have you encountered this error?

Thanks,
Donard
Quote
0 #73 michelle01 2012-11-12 05:42
Thank you very much for this tutorial - it has been great help in implementing my current program. However, I am experiencing the same problem as Steve above, having spent days (literally!) trying to fix it, but in vain.

Quote:
Thank you for the great sample code. I am able to open, save my pdf file after clicking on a button on page, but the problem is that when I closed the pdf window, my other buttons on the base form do not work, I got a message of "You cannot complete this task because you accessed this page using the browser's navigation buttons (the browser Back button, for example)." Have you seen this kind of error before. Thank you in advance.


Does anyone know a solution to this problem?
Quote
0 #74 Narender 2012-11-30 16:24
Hi Prabhakar,

Tha nk you so much for the great tutorial. But I have a wierd requirement. I would be really thankfull if you can provide some inputs.
When the button is clicked on the self service page, the PDF has to go to the printer without previewing it. Is there anyway to achieve this? PLEASE HELP...

Thanks ,
Narender
Quote
0 #75 Ganesh Golla 2013-05-23 06:27
Hi All,

can anyone help me, i followed the previous steps and the PDF was generated but when i tried to open it an
error message as below
"Adobe Reader could not open because it either not a supported file or because the file has been damaged(for example , it was sent as an email attachment and wasn't correctly decoded"

even i have XDO folder in my classes folder
Did anyone solve this problem, Please advice what to do?
or send it to my email
Quote
0 #76 KULASEKHAR 2013-06-10 10:27
XMLNode xmlnode = (XMLNode)header voimpl.writeXML (6, 0L);
XMLNode xmlnode1 = null;
XMLNode xmlnode2 = null;
if(!isNull(as[2 ]) && "Y".equalsIgnor eCase(as[2]))
{
HeaderTemplateV OImpl headertemplatev oimpl = getHeaderTempla teVO();
headertemplatev oimpl.setWhereClauseParam(0, as[8]);
headertemplatev oimpl.executeQuery();
headertemplatev oimpl;
xmlnode1 = (XMLNode)headertemplatev oimpl.writeXML(3, 0L);
}

The above code

XMLNode xmlnode = (XMLNode)header voimpl.writeXML (6, 0L);

xmlnode1 = (XMLNode)headertemplatev oimpl.writeXML(3, 0L);

WriteXML( 6,0L) and writeXML(3, 0L) What are why those are using icant understand that thngs and

6, 0L what is the meaning of those thimgs.

please help me
Quote
0 #77 KumarKK 2014-02-21 10:33
Hello,

I want to display the output using different html tags to beautify the output in pdf. Your demo works great but when my data contains the html tags inside the xml template, it's only displaying the tags directly instead of displaying the formatted data.

Any suggestions on how to deal with this?

Thank You
Raj
Quote
0 #78 TeksonitServices 2014-08-23 13:50
Thanks For Your Information and Any body wants

learn Oracle OAF through Online for Details Please go through the Link


Oracle OAF Online Training with free demo in INDIA | GERMANY | USA | UK

This Will Helps you aalot.
Quote

Add comment


Security code
Refresh

You are here: Home Contributors Prabhakar Somanathan Integrating XML Publisher and OA Framework