Fusion Blog

EBS Blog


Contact Us

OA Framework - All Articles
  • Register

Oracle Gold Partners, our very popular training packages, training schedule is listed here
Designed by Five Star Rated Oracle Press Authors & Oracle ACE's.

webinar new Click here to raise Support Ticket. Get reply within 48 hours.

Search Courses

User Rating: 5 / 5

Star ActiveStar ActiveStar ActiveStar ActiveStar Active

Approach to get a PDF output on button click in R12.2.X is different from the lower version of R12. Let understand what exactly a requirement is. 


Requirement: User wants a button in OAF page, which on click gives a PDF output.


1: In this article we will learn to get PDF output using a VO, and in the next article I will provide a solution how to integrate a XDO/BI publisher report in OAF page

2: This article requires a developer to a have better understanding of OAF concept.

Frequently ask question:

Question 1: If it is possible to call a report in 11i from OAF page, why can’t we use the same approach?

Answer: In R12.2.X, report server cannot be invoked from OAF page due to weblogic server as oracle corporation moving toward Oracle fusion

Question 2: Are there any changes at server level?


Answer: Yes, in R12.2.X, BI publisher take place of XML publisher. So when you compare the folder on server in R12.1 and R12.2 under path $JAVA_TOP/oracle/apps/xdo, you can easily identify the difference.


Question 3: Having so many roadblocks, what’s the solution?

Answer: Guys !! You are on right place. Let me explain you the foundation for our solution using below PPT.

 gen_pdf_01.jpggen pdf 01


From above screenshot it clear enough that we are going to use RTF template and also XML data.

But now the question arises from where we get the XML data. So the answer is VO or any other source which generates XML data.

In this article I will use VO as my data source and in my next article will use XDO/BI publisher to get XML data, as we all know that it not possible for huge computation in OAF VO.


Step 1: Create an OAF page with button and attach controller to page

Step 2: create VO and AM. Then attach VO to AM

Below are the VO code
Select eno,ename,salary from emp;

Step 3: Create an RTF and place it to local folder in C: drive

Step 4: Write below code in Application module


public XMLNode getEmpDataXML()

          OAViewObject vo = (OAViewObject)findViewObject("xxEmpVO1");

           // Exceute VO
          XMLNode xmlNode = (XMLNode)vo.writeXML(4, XMLInterface.XML_OPT_ALL_ROWS);
          return xmlNode;
     } catch (Exception e)
       throw new OAException(e.getMessage() + "Custom Error");


Step 5: Write below code in controller, prcocessFormRequest method


public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
super.processFormRequest(pageContext, webBean);

//Get Session and Response
OAApplicationModule am= (OAApplicationModule)pageContext.getApplicationModule(webBean);
DataObject sessionDictionary = (DataObject)pageContext.getNamedDataObject("_SessionParameters");
HttpServletResponse response = (HttpServletResponse)sessionDictionary.selectValue(null,"HttpServletResponse");

// Set the Output Report File Name and Content Type
String contentDisposition = "attachment;filename=EmpOutput.pdf";

if(pageContext.getParameter("PrintPDFBtn") != null) {

ServletOutputStream os = response.getOutputStream();

//Calling RTF Processor
//RTF Processor generate XSL
RTFProcessor rtfProcessor = new RTFProcessor("C:\\EMPTemplate.rtf");
ByteArrayOutputStream xlsOutputStream = new ByteArrayOutputStream();

// Get the XML Data as the XMLNode from VO
XMLNode xmlNode = (XMLNode) am.invokeMethod("getEmpDataXML");
ByteArrayOutputStream localByteArrayOutputStream = new ByteArrayOutputStream();
ByteArrayInputStream xmlInputStream = new ByteArrayInputStream(localByteArrayOutputStream.toByteArray());

//Calling FO Processor
//FO processor take XML data and RTF as XSL and generate PDF output
FOProcessor processor = new FOProcessor();
ByteArrayOutputStream pdfOutputStream = new ByteArrayOutputStream();
processor.setData(xmlInputStream); //set xml input Stream
ByteArrayInputStream xlsInputStream = new ByteArrayInputStream(xlsOutputStream.toByteArray());
processor.setTemplate(xlsInputStream); //set xsl input file

}catch(XDOException e){

// Write the PDF Report to the HttpServletResponse object and flush.
byte[] b = pdfOutputStream.toByteArray();
os.write(b, 0, b.length);

catch(Exception e){
throw new OAException("Deepak kessarwaani="+e.getMessage(), OAException.ERROR);



Step 6: Run a page and on button click you will get PDF output



Techie DK


0 #1 Harish Nunna 2015-01-27 13:23
Nice article Deepak, thank you :)
0 #2 Muhammad Abbas 2015-08-26 06:26
Thanks for writing this blog.
I am trying it but not able to locate class files like,
RTFProcessor and FOProcessor.

Can you please tell me import path for these classes.
Looking forward for your response.

Abbas Qureshi

Add comment

Security code

About the Author

Techie DK

Search Trainings

Fully verifiable testimonials

Apps2Fusion - Event List

<<  Jun 2021  >>
 Mon  Tue  Wed  Thu  Fri  Sat  Sun 
   1  2  3  4  5  6
  7  8  910111213

Enquire For Training

Fusion Training Packages

Get Email Updates

Powered by Google FeedBurner