Vous êtes sur la page 1sur 14

6/26/12

BI Publisher Document Viewer Common Region - Embeded Report Output in OA Framework Page Part 2

APPS TO FUSION
.......Our Journey from Apps To Fusion

Home Solutions

Technical Articles

Training Articles

Receive Email for New Articles

Contributors

Forum

My Book

RELATED ITEMS
XML Publisher and Data Template - SQL Query to develop BI Publisher Reports BI Publisher Report Migration Utility BI Publisher Password Protect Documents Training - BI Publisher [ XML Publisher ] BI Publisher Document Viewer Common RegionEmbeded Report Output in OA Framework Page Matrix Report in BI Publisher Generating Excel Outputs from existing standard Oracle Reports in Oracle EBusiness Suite R12 How to create a XML Publisher report to display BLOB images from an RDF report Oa Framework - Xml Publisher Integration for R12

BI Publisher Document Viewer Common Region - Embeded Report Output in OA Framework Page Part 2
Monday, 16 June 2008 12:21 Prabhakar Somanathan

User Rating: Poor

/2 Best RA TE

The XML Publisher common user interface document viewer or common region is an Oracle Applications Framework (OAF) shared region provided by XML Publisher to view the XML Publisher report in HTML,PDF,RTF,EXCEL format inline within OA Framework page. Please read the article BI Publisher Document Viewer Common Region- Embeded Report Output in OA Framework Page to understand the basics of XML Publisher Document Viewer Region. Every XML Publisher/BI Publisher report requires the creation of Data XML RTF Template Date Definition Template Definition Note : The Template can be defined in RTF, PDF, Excel .. Please read the article Integrating XML Publisher and OA Framework to understand the basics of XML Publisher/BI Publisher and the steps involved in creating the above mentioned components. The data source is the method of obtaining the data XML file required for the report. This article discusses in details the steps involved in integrating XML Publisher Document Viewer Region with OA Framework page using Blob Domain data source. The Blob Domain data source is used when we want to report on a low volume of data in database tables or we have the XML data available in database table BLOB column. The Document Viewer Region requires the following page context parameter for its initialization.

SEARCH APPS2FUSION
SEARCH Name p_DataSource p_DataSourceCode Mandatory Yes Yes Description BlobDomain Enter the DataSourceCode from the Template Manager repository Enter the Application Short name for the data source definition. Enter the BLOBDomain that contains the XML data file Specify the Template to be used to render the report. If not set, then the XML Publisher provides a LOV to select the

p_DataSourceAppsShortName

Yes

XML_DATA_FILE p_TemplateCode

Yes No

apps2fusion.com//294-bi-publisher-document-viewer-common-region-embeded-report-output-in-oa-

1/14

6/26/12

BI Publisher Document Viewer Common Region - Embeded Report Output in OA Framework Page Part 2
templates based on p_DataSourceCode parameter . p_TemplateAppsShortName Required only when p_TemplateCode is set. p_LocaleNo No The value "Default" can be entered to select the default template locale. If not set, then XML Publisher provides a e a list to select available locales for the selected template. p_OutputTypeNo No Valid output types are: RTF, PDF, EXCEL, and HTML, depending on the template type. If not set, then XML Publisher will provide a list to select the output types. p_XDORegionHeight Yes Height of the XDO common region window expressed as a percentage Enter the Application short name of the application to which the template is assigned in the Template Manager.

Lets start developing a simple OAF page to generate a XML Publisher Employee Detail Report of employees working in a particular Department. The page will look like this.

apps2fusion.com//294-bi-publisher-document-viewer-common-region-embeded-report-output-in-oa-

2/14

6/26/12

BI Publisher Document Viewer Common Region - Embeded Report Output in OA Framework Page Part 2

apps2fusion.com//294-bi-publisher-document-viewer-common-region-embeded-report-output-in-oa-

3/14

6/26/12

BI Publisher Document Viewer Common Region - Embeded Report Output in OA Framework Page Part 2

Steps involved : 1) Designing the OAF BC4J Data Model. 2) Designing the OAF Page and generating the Data XML 3) Designing the RTF Template using Data XML 4) Registering the Template with Oracle Applications. 5) Design the Employee Report OAF Page with Document Viewer Region 6) Set the Page Context Parameters and data XML 7) Execute the page. The steps 1 to 4 are same as the steps 2 to 5 explained in article Integrating XML Publisher and OA Framework. Lets discuss with step 5 onwards. Step 5 : Design the Employee Report OAF Page with Document Viewer Region Design a OAF page with two regions. The Region 1 should have a Text Input for Dept No search. The Region 2 should be based on the XML Publisher Document Viewer Region "/oracle/apps/xdo/oa/common/webui/DocumentViewerRn.MainRegion" . The Page should look like this.

Step 6 : Set the Page Context Parameters and generate the data XML Set the page context parameters required for the BlobDomain datasource in the controller's processRequest method.

apps2fusion.com//294-bi-publisher-document-viewer-common-region-embeded-report-output-in-oa-

4/14

6/26/12

BI Publisher Document Viewer Common Region - Embeded Report Output in OA Framework Page Part 2
Handle the Run submit button in the processFormRequest , generate the data XML and set the XML_DATA_BLOB page context parameter. Controller Code : Import : import java.io.OutputStream; import oracle.apps.fnd.common.AppsContext; import oracle.apps.xdo.oa.util.OAHelper; import oracle.jbo.domain.BlobDomain; import oracle.xml.parser.v2.XMLNode; import java.io.ByteArrayOutputStream; ProcessRequest : public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean); // Get the current Locale OAApplicationModule am = pageContext.getApplicationModule(webBean); AppsContext appscontext = ((OADBTransactionImpl)am.getOADBTransaction()).getAppsContext(); String locale = null; try { String as[] = OAHelper.getISOCodes(appscontext, appscontext.getCurrLangCode()); locale = as[0]+"-"+as[1]; } catch(SQLException sqlexception) { throw new OAException(sqlexception.getMessage(), (byte)0); } // Set the page context parameter required for datasource BlobDomain. pageContext.putParameter("p_DataSource", "BlobDomain"); pageContext.putParameter("p_DataSourceCode", "EmpDataDefinition"); pageContext.putParameter("p_DataSourceAppsShortName", "XXXX"); pageContext.putParameter("p_XDORegionHeight", "700"); pageContext.putParameter("p_TemplateCode", "Emp_Template"); pageContext.putParameter("p_TemplateAppsShortName", "XXXX"); pageContext.putParameter("p_Locale", locale); } ProcessFormRequest : public void processFormRequest(OAPageContext pageContext, OAWebBean webBean) { super.processFormRequest(pageContext, webBean); OAApplicationModule am = pageContext.getApplicationModule(webBean); // Handle the Run button event. if(pageContext.getParameter("Go") != null) { String deptNo = pageContext.getParameter("DeptNo"); Serializable params[] = { deptNo }; // Generate the Data XML. The data xml should contain the employees of the specified dept // number XMLNode xmlNode = (XMLNode) am.invokeMethod("getDeptEmpDataXML",params); try{ // Create a blob object and add the data xml to it. BlobDomain blob = new BlobDomain(); OutputStream os = blob.getBinaryOutputStream(); xmlNode.print(os); os.close();

apps2fusion.com//294-bi-publisher-document-viewer-common-region-embeded-report-output-in-oa-

5/14

6/26/12

BI Publisher Document Viewer Common Region - Embeded Report Output in OA Framework Page Part 2
pageContext.putSessionValueDirect("XML_DATA_BLOB", blob); } catch(Exception e) { throw new OAException(e.getMessage(), (byte)0); } } } EmpAMImpl : // In this example we are generating data xml from data in existing database table. We can // also get the the data xml from a blob column in a database table. public XMLNode getDeptEmpDataXML(String deptNo) { EmpVOImpl vo = getEmpVO1(); vo.initQuery(deptNo); XMLNode xmlNode = (XMLNode) vo.writeXML(4, XMLInterface.XML_OPT_ALL_ROWS); return xmlNode; }

EmpVOImpl : public void initQuery(String deptNo) { setWhereClause(null); setWhereClauseParams(null); setWhereClause("DEPTNO = :1"); setWhereClauseParam(0, deptNo); executeQuery(); } Step 7 : Execute the OAF page Deploy the OAF and the BC4J components in the middle tier. Open the OAF page, enter the dept number and click on the run button. This will generate a inline Employee XML Publisher Report. Select the output format as per the requirement. Note : Testing the XML Publisher Report from Jdeveloper requires setting up multiple libraries in the classpath. Hence i would suggest testing the code in the middle tier directly. If any one has worked on different approach of implementing the BlobDomain DataSource, then please share the implementation logic.

Hits: 10780

Email This

Bookmark

Set as favorite

Comments (18)
Subscribe to this comment's feed

...
w ritten by Shiva1 , June 16, 2008

Hi Prabhakar,

apps2fusion.com//294-bi-publisher-document-viewer-common-region-embeded-report-output-in-oa-

6/14

6/26/12

BI Publisher Document Viewer Common Region - Embeded Report Output in OA Framework Page Part 2
Thanks for providing an excellent article , straightly delivering inout desk tops I see a typo, just want to make sure its in " Process Request " where we want to load the page with the template setting. I see though the heading shows its process request, in the code you wrote this for processFormRequest(), please confirm this. Thanks Again. Regards, Siva. ProcessRequest : public void processFormRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean); // Get the current Locale OAApplicationModule am = pageContext.getApplicationModule(webBean); AppsContext appscontext = ((OADBTransactionImpl)am.getOADBTransaction()).getAppsContext(); String locale = null; try { String as[] = OAHelper.getISOCodes(appscontext, appscontext.getCurrLangCode()); locale = as[0]+"-"+as[1]; } catch(SQLException sqlexception) { throw new OAException(sqlexception.getMessage(), (byte)0); } // Set the page context parameter required for datasource BlobDomain. pageContext.putParameter("p_DataSource", "BlobDomain"); pageContext.putParameter("p_DataSourceCode", "EmpDataDefinition"); pageContext.putParameter("p_DataSourceAppsShortName", "XXXX"); pageContext.putParameter("p_XDORegionHeight", "700"); pageContext.putParameter("p_TemplateCode", "Emp_Template"); pageContext.putParameter("p_TemplateAppsShortName", "XXXX"); pageContext.putParameter("p_Locale", locale); }
Votes: +0

vote up

vote down

report abuse

How to deploy ?
w ritten by St , July 08, 2008

How to Deploy ? Please explain where to put these files ebiz.


Votes: +0

vote up

vote down

report abuse

question
w ritten by Jay Patw a , August 11, 2008

Note : Testing the XML Publisher Report from Jdeveloper requires setting up multiple libraries in the classpath. Hence i would suggest testing the code in the middle tier directly. Can you please elaborate on above note that you have put.
Votes: +0

vote up

vote down

report abuse

...
w ritten by Baris , October 06, 2008

Hi Prabhakar, The link including the step how to register template in XML to Oracle "Integrating XML Publisher and OA

apps2fusion.com//294-bi-publisher-document-viewer-common-region-embeded-report-output-in-oa-

7/14

6/26/12

BI Publisher Document Viewer Common Region - Embeded Report Output in OA Framework Page Part 2
Framework" does not work(error 404) that is the point I think will be helpful for me Thanks in advance
Votes: -1

vote up

vote down

report abuse

...
w ritten by barozkok , October 09, 2008

Hi, First thanks for this educative article. I am new in OA Framework. I tried to develop the project in OA Framework to call XML Publisher. But I got error in AMimpl "XMLNode xmlNode = (XMLNode) vo.writeXML(4, XMLInterface.XML_OPT_ALL_ROWS);" at line as "XMLInterface class not found". What to do for this error? Thanks.
Votes: +0

vote up

vote down

report abuse

a little help!
w ritten by Carl , December 30, 2008

Hi, maybe you can help me i am presently using the following code (this is just a sample) but as you can see i am physically creating 2 files on the server. The space they use is not problematic since i have a cron job that empties the directory every day but the problem is that i have to hard code the path of the files. I see in your code that at no moment you are in contact with real files. I was wondering if you knew how to have relative paths that would work on every instance apps without modifications or any suggestions that would allow me to fix this issue without changing my code totally.

Blob rtf = rs.getBlob(1); //Processing of the file rtf --> xsl --> pdf //using 2 different processors RTF and FO RTFProcessor rtfProcessor = new RTFProcessor(rtf.getBinaryStream()); rtfProcessor.setOutput(xslPath); rtfProcessor.process() FOProcessor processor = new FOProcessor(); processor.setData(xml.getCharacterStream()); processor.setTemplate(xslPath); processor.setOutput(outputPath); processor.setOutputFormat(FOProcessor.FORMAT_PDF); processor.generate();

regards, carl
Votes: +0

vote up

vote down

report abuse

Alternative: BlobDomain from data template


w ritten by Radu Lascae , February 26, 2009

Hi, I found this site very useful, thank you for this. Since the question on the alternative approach on the BlobDomain went unanswered, I thought to contribute. This alternative approach will work in R12 without the need for a view object. It uses the data source parameters - it assumes there is a parameter called DEPTO in your data template. The code is not that tidy (I've adapted it from a current project). Given your example: import com.sun.java.util.collections.ArrayList; import com.sun.java.util.collections.Iterator; import java.io.ByteArrayOutputStream; import java.io.OutputStream; import java.sql.SQLException;

apps2fusion.com//294-bi-publisher-document-viewer-common-region-embeded-report-output-in-oa-

8/14

6/26/12

BI Publisher Document Viewer Common Region - Embeded Report Output in OA Framework Page Part 2
import oracle.apps.fnd.common.AppsContext; import oracle.apps.fnd.framework.server.OADBTransactionImpl; import oracle.apps.fnd.framework.webui.OAPageContext; import oracle.apps.xdo.XDOException; import oracle.apps.xdo.dataengine.Parameter; import oracle.apps.xdo.oa.util.DataTemplate; import oracle.jbo.domain.BlobDomain; public static BlobDomain processTemplate(OAPageContext pageContext, String deptNo){ AppsContext appsContext = ((OADBTransactionImpl)pageContext.getRootApplicationModule().getOADBTransaction()).getAppsContext(); String applicationShortName = "XXXX"; String dataSourceCode = "EmpDataDefinition";

OutputStream os = new ByteArrayOutputStream(); try { DataTemplate dataTemplate = new DataTemplate(appsContext, applicationShortName, dataSourceCode); //Get Parameters ArrayList parameters = dataTemplate.getParameters(); //set Parameter Values as ArrayList of oracle.apps.xdo.dataengine.Parameter Iterator it = parameters.iterator(); while (it.hasNext()){ Parameter p = (Parameter) it.next(); System.out.println("parameter name: " + p.getName()); if (p.getName().equals("DEPTNO")){ p.setValue(deptNo); } } //dataTemplate.setOutput("C:temptryit.xml"); dataTemplate.setOutput(os); dataTemplate.processData(); System.out.println(os.toString()); } catch (SQLException e) { System.out.println("SQLException occurred."); } catch (XDOException e) { System.out.println("XDOException occurred."); } catch(Exception e){ System.out.println("Exception (other) occurred."); } byte[] xmlb = os.toString().getBytes(); BlobDomain blob = new BlobDomain(xmlb); return blob; }//end processTemplate Regards, Radu
Votes: +0

vote up

vote down

report abuse

...
w ritten by new _member , June 02, 2009

Hi Prabhakar Somanathan, Greate article. I am new in OAF. I am trying to develop OAF to call XML publisher. Could you send to me the source code of 7 steps above?

apps2fusion.com//294-bi-publisher-document-viewer-common-region-embeded-report-output-in-oa-

9/14

6/26/12

BI Publisher Document Viewer Common Region - Embeded Report Output in OA Framework Page Part 2
Many thanks for your help
Votes: +0

vote up

vote down

report abuse

xml output from report


w ritten by rakesh1836 , June 16, 2009

Hi can anyone share. how to use the xml output from the report in the OA Framework. like here we are getting the xml from the View object
Votes: +1

vote up

vote down

report abuse

Error while runing the Document Viewer Page


w ritten by venkat Reddy Pulichintha , August 25, 2009

Hi Prabhakar, I saw your articale really good i reached Integrating XML Publisher and OA Framework I tried Document Viewer. as per your steps i done. i tested in Midle tier. am able to see the page once i enter the DeptNo 10 am getting error as per below oracle.apps.fnd.framework.OAException: java.lang.ClassCastException: oracle.xml.parser.v2.XMLElement cannot be cast to oracle.help.common.xml.XMLNode Thanks Venkat
Votes: +0

vote up

vote down

report abuse

Export to Excel is not working


w ritten by Rishav , August 31, 2009

Export functionality is not working as expected for "Excel" output. It is saving as type "Adobe Acrobat Reader" for "Excel" output.
Votes: -1

vote up

vote down

report abuse

Implementing OAF - XML Publisher - Shared region - Common Document viewer region
w ritten by Sateesh D , October 31, 2009

Hi Prabhakar, I found this site is very useful. I have implemented BI Publisher Document Viewer Common Region, as per the steps that you have provided. The page looks like the one that you mentioned in step5. 1) I have created one region with department number text input. 2) I have copied the commonRN from /oracle/apps/xdo/oa/common/webui/DocumentViewerRn.xml and pasted the region into my page and changed some parameters like controller class. 3) I have created implemented the controller code, AM Impl code and VO Impl code as provided in step 6. 4) I have deployed it in the middle tier directly. But when I enter the parameter Dept Number and selected output type and clicked on the Run button, nothing is happening. Neither it is giving the error nor the required output. Please clarify, whether we have to take care about any small things. Like adding DocumentHelper.getOutputURL() The in that case, please guide me of how I can provide in this case. It would be great if you clarify this ASAP. Thanks in Advance for your reply. Regards, Sateesh.
Votes: +0

vote up

vote down

report abuse

apps2fusion.com//294-bi-publisher-document-viewer-common-region-embeded-report-output-in-oa-

10/14

6/26/12

BI Publisher Document Viewer Common Region - Embeded Report Output in OA Framework Page Part 2
...
w ritten by Sateesh D , October 31, 2009

Hi Prabhakar, This is my controller code for your reference: public class DocViewerCO extends OAControllerImpl { public static final String RCS_ID="$Header$"; public static final boolean RCS_ID_RECORDED = VersionInfo.recordClassVersion(RCS_ID, "&#xpa;ckagename%");

public void processRequest(OAPageContext pageContext, OAWebBean webBean) { super.processRequest(pageContext, webBean); // Get the current Locale OAApplicationModule am = pageContext.getApplicationModule(webBean); AppsContext appscontext = ((OADBTransactionImpl)am.getOADBTransaction()).getAppsContext(); String locale = null; try { String as[] = OAHelper.getISOCodes(appscontext, appscontext.getCurrLangCode()); locale = as[0]+"-"+as[1]; } catch(SQLException sqlexception) { throw new OAException(sqlexception.getMessage(), (byte)0); } // Set the page context parameter required for datasource BlobDomain. pageContext.putParameter("p_DataSource", "BlobDomain"); pageContext.putParameter("p_DataSourceCode", "EmpDataDefinition"); pageContext.putParameter("p_DataSourceAppsShortName", "AK"); pageContext.putParameter("p_XDORegionHeight", "700"); pageContext.putParameter("p_TemplateCode", "Emp_Template"); pageContext.putParameter("p_TemplateAppsShortName", "AK"); pageContext.putParameter("p_Locale", locale); }

public void processFormRequest(OAPageContext pageContext, OAWebBean webBean) { super.processFormRequest(pageContext, webBean); OAApplicationModule am = pageContext.getApplicationModule(webBean); // Handle the Run button event. if(pageContext.getParameter("Go") != null) { String deptNo = pageContext.getParameter("deptno"); System.out.println("Department Number: " + deptNo); String outType = pageContext.getParameter("OutputType");

Serializable params[] = {deptNo}; // Generate the Data XML. The data xml should contain the employees of the specified dept // number XMLNode xmlNode = (XMLNode) am.invokeMethod("getDeptEmpDataXML",params); System.out.println(xmlNode);

apps2fusion.com//294-bi-publisher-document-viewer-common-region-embeded-report-output-in-oa-

11/14

6/26/12

BI Publisher Document Viewer Common Region - Embeded Report Output in OA Framework Page Part 2
try{ // Create a blob object and add the data xml to it. BlobDomain blob = new BlobDomain(); OutputStream os = blob.getBinaryOutputStream(); xmlNode.print(os); System.out.println("After XMLNode Print"); os.close(); pageContext.putSessionValueDirect("XML_DATA_BLOB", blob); System.out.println(" After Put session Value direct"); /* Properties pr = new Properties(); String redirectURL = DocumentHelper.getOutputURL(pageContext, APP_SHORT_NAME, TEMPLATE_CODE, //result.getBinaryStream(), blob.getBinaryStream(), outType, pr, "en", "US" );

OAHTMLWebBean outRegion = (OAHTMLWebBean)createWebBean(pageContext,HTML_WEB_BEAN, null, "IFRAME"); outRegion.setHTMLAttributeValue("src",redirectURL); outRegion.setHTMLAttributeValue("width", "100%"); outRegion.setHTMLAttributeValue("height", "60%"); outRegion.setHTMLAttributeValue("title",TEMPLATE_CODE); outRegion.setHTMLAttributeValue("name",TEMPLATE_CODE); pageContext.getPageLayoutBean().addIndexedChild(outRegion);*/ } catch(Exception e) { throw new OAException(e.getMessage(), (byte)0); } } }

Please help me in resolving this issue. Thanks Sateesh.


Votes: +0

vote up

vote down

report abuse

Thanks for the explanation


w ritten by akhil Kumar , June 03, 2010

Hi Prabhakar, I tried exactly like you specified but its not working for me. I am getting an error "An error encounterd either due to invalied Template details or due to null Data Input Stream." Please suggest. Thanks Akhil
Votes: +0

vote up

vote down

report abuse

...
w ritten by sm , August 02, 2010

apps2fusion.com//294-bi-publisher-document-viewer-common-region-embeded-report-output-in-oa-

12/14

6/26/12

BI Publisher Document Viewer Common Region - Embeded Report Output in OA Framework Page Part 2
hi, The screenshots in the documents are not visible. Can you please check and let me know, if there is problem with my system or with site. If possible, can you please insert the screenshots. Thanks,
Votes: +0

vote up

vote down

report abuse

Multiple BI Reports in OAF


w ritten by sm , August 26, 2010

Hi, Can you please tell me if its possible to display more than one BI report outputs embedded in OAF page..... If yes, how can we achive this..... Or any pointers will be of great help. Thanks in advane..
Votes: +0

vote up

vote down

report abuse

Can we Rename the PDF File generated ? Also Bullet Points show as ???
w ritten by Sujay , November 18, 2010

Hi, We are working on an XML Publisher Report PDF rendered from a Self Service Page. We have the final XML as a string, When I try to Preview PDF using this XML string locally in my desktop, The Bullet Points from the fields are rendered properly. However, When we render the same field by deploying into applications, we see all the Bullet Points as ??? The bullet points used as Boiler plates appear correctly. We are converting the string to a BlobDomain in the controller of the Page. Below is the code: BlobDomain xmlData = new BlobDomain(XMLString.getBytes() ); redirectURL = DocumentHelper.getOutputURL( pageContext ,"XX" ,templateName ,xmlData.getBinaryStream() ,"PDF" ,null ,"en" ,"US" ); Not sure if this conversion is converting the bullet points into ??? Any help in this regard will be highly appreciated. Also, Can we rename the PDF File generated ??? Thanks in advance. Sujay
Votes: +0

vote up

vote down

report abuse

Whats in the EmpVO?


w ritten by Dave , June 21, 2012

I'm very familiar with BI publiser within EBS, and I'm very familier with OAF. since the sql statement is in the XML Data definition inside EBS, is there SQL in the EmpVO or is this just an object you need to set the parameters up? thanks!
Votes: +0

vote up

vote down

report abuse

apps2fusion.com//294-bi-publisher-document-viewer-common-region-embeded-report-output-in-oa-

13/14

6/26/12

BI Publisher Document Viewer Common Region - Embeded Report Output in OA Framework Page Part 2

Write comment
Name

Email

Title

Comment

smaller | bigger Subscribe via email (Registered users only)

Write the displayed characters

Add Comment

Last Updated ( Thursday, 26 June 2008 22:35 )

apps2fusion.com//294-bi-publisher-document-viewer-common-region-embeded-report-output-in-oa-

14/14