Login
Register

Home

Trainings

Fusion Blog

EBS Blog

Authors

CONTACT US

Prabhakar Somanathan
  • 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

Search Courses

XML Publisher/BI Publisher Document Viewer ( Common Region ) - Blob Domain

 

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.

 

Name

Mandatory

Description

p_DataSource

Yes

BlobDomain

p_DataSourceCode

Yes

Enter the DataSourceCode from the Template Manager repository

p_DataSourceAppsShortName

Yes

Enter the Application Short name for the data source definition.

XML_DATA_FILE

Yes

Enter the BLOBDomain that contains the XML data file

p_TemplateCode

No

Specify the Template to be used to render the report. If not set, then the XML Publisher provides a LOV to select the templates based on p_DataSourceCode parameter .

p_TemplateAppsShortName

Required only when p_TemplateCode is set.

Enter the Application short name of the application to which the template is assigned in the Template Manager.

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

 

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

 

 

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. 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 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);   

  }

 

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();

        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.

 


Prabhakar Somanathan

Comments   

0 #1 Shiva1 2008-06-16 14:53
Hi Prabhakar,

Tha nks 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 processFormRequ est(), please confirm this.

Thanks Again.

Regards ,
Siva.

Proces sRequest :
public void processFormRequ est(OAPageConte xt pageContext, OAWebBean webBean)
{
supe r.processReques t(pageContext, webBean);

// Get the current Locale
OAApplic ationModule am = pageContext.get ApplicationModu le(webBean);
Ap psContext appscontext =
((OADBTransact ionImpl)am.getO ADBTransaction( )).getAppsConte xt();
String locale = null;
try
{
Str ing as[] = OAHelper.getISO Codes(appsconte xt, appscontext.get CurrLangCode()) ;
locale = as[0]+"-"+as[1] ;
}
catch(SQLEx ception sqlexception)
{
throw new OAException(sql exception.getMe ssage(), (byte)0);
}

// Set the page context parameter required for datasource BlobDomain.
pag eContext.putPar ameter("p_DataS ource", "BlobDomain");
pageContext.put Parameter("p_Da taSourceCode", "EmpDataDefinit ion");
pageCont ext.putParamete r("p_DataSource AppsShortName", "XXXX");
pageCo ntext.putParame ter("p_XDORegio nHeight", "700");
pageCon text.putParamet er("p_TemplateC ode", "Emp_Template") ;
pageContext.p utParameter("p_ TemplateAppsSho rtName", "XXXX");
pageCo ntext.putParame ter("p_Locale", locale);
}
Quote
0 #2 St 2008-07-08 23:41
How to Deploy ?

Please explain where to put these files ebiz.
Quote
0 #3 Jay Patwa 2008-08-11 16:40
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.
Quote
0 #4 Baris 2008-10-06 10:26
Hi Prabhakar,

The link including the step how to register template in XML to Oracle "Integrating XML Publisher and OA Framework" does not work(error 404) that is the point I think will be helpful for me :)
Thanks in advance
Quote
0 #5 barozkok 2008-10-09 04:42
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.XM L_OPT_ALL_ROWS) ;"
at line as "XMLInterface class not found". What to do for this error?
Thanks.
Quote
0 #6 Carl 2008-12-30 15:03
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(rt f.getBinaryStre am());
rtfProcessor.se tOutput(xslPath );
rtfProcessor.pr ocess()
FOProcessor processor = new FOProcessor();
processor.setDa ta(xml.getChara cterStream());
processor.setTe mplate(xslPath) ;
processor.setOu tput(outputPath );
processor.setOu tputFormat(FOPr ocessor.FORMAT_ PDF);
processor.gener ate();


regard s,

carl
Quote
+1 #7 Radu Lascae 2009-02-26 03:38
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.

Th is 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:

impor t com.sun.java.ut il.collections. ArrayList;
impo rt com.sun.java.ut il.collections. Iterator;

impo rt java.io.ByteArr ayOutputStream;
import java.io.OutputS tream;

import java.sql.SQLExc eption;

import oracle.apps.fnd .common.AppsCon text;
import oracle.apps.fnd .framework.serv er.OADBTransact ionImpl;
import oracle.apps.fnd .framework.webu i.OAPageContext ;
import oracle.apps.xdo .XDOException;
import oracle.apps.xdo .dataengine.Par ameter;
import oracle.apps.xdo .oa.util.DataTe mplate;

import oracle.jbo.doma in.BlobDomain;

public static BlobDomain processTemplate (OAPageContext pageContext, String deptNo){
AppsContext appsContext = ((OADBTransacti onImpl)pageCont ext.getRootAppl icationModule() .getOADBTransac tion()).getApps Context();
String applicationShor tName = "XXXX";
String dataSourceCode = "EmpDataDefinit ion";


OutputStream os = new ByteArrayOutput Stream();

try {
DataTemplate dataTemplate = new DataTemplate(ap psContext, applicationShor tName, dataSourceCode) ;

//Get Parameters
ArrayList parameters = dataTemplate.ge tParameters();
//set Parameter Values as ArrayList of oracle.apps.xdo .dataengine.Par ameter
Iterator it = parameters.iter ator();

while (it.hasNext()){
Parameter p = (Parameter) it.next();
System.out.prin tln("parameter name: " + p.getName());
if (p.getName().eq uals("DEPTNO")) {
p.setValue(dept No);
}
}

//dataTemplate. setOutput("C:\t emp\tryit.xml") ;
dataTemplate.se tOutput(os);
dataTemplate.pr ocessData();
System.out.prin tln(os.toString ());

} catch (SQLException e) {
System.out.prin tln("SQLExcepti on occurred.");
} catch (XDOException e) {
System.out.prin tln("XDOExcepti on occurred.");
} catch(Exception e){
System.out.prin tln("Exception (other) occurred.");
}

byte[] xmlb = os.toString().g etBytes();
BlobDomain blob = new BlobDomain(xmlb );
return blob;

}//end processTemplate

Regards,
Radu
Quote
0 #8 new_member 2009-06-02 11:50
Hi Prabhakar Somanathan,
Gre ate article.

I am new in OAF. I am trying to develop OAF to call XML publisher.
Coul d you send to me the source code of 7 steps above?

Many thanks for your help
Quote
0 #9 rakesh1836 2009-06-16 05:29
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
Quote
0 #10 venkat Reddy Pulichintha 2009-08-25 02:16
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.ap ps.fnd.framewor k.OAException: java.lang.Class CastException: oracle.xml.pars er.v2.XMLElemen t cannot be cast to oracle.help.com mon.xml.XMLNode

Thanks
Venkat
Quote
0 #11 Rishav 2009-08-31 07:52
Export functionality is not working as expected for "Excel" output. It is saving as type "Adobe Acrobat Reader" for "Excel" output.
Quote
0 #12 Sateesh D 2009-10-31 11:16
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/xd o/oa/common/web ui/DocumentView erRn.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. :)
Quote
0 #13 Sateesh D 2009-10-31 11:19
Hi Prabhakar,

Thi s is my controller code for your reference:

public class DocViewerCO extends OAControllerImp l
{
public static final String RCS_ID="$Header $";
public static final boolean RCS_ID_RECORDED =
VersionInfo.rec ordClassVersion (RCS_ID, "&#xpa;ckagenam e%");



public void processRequest( OAPageContext pageContext, OAWebBean webBean)
{
super.processRe quest(pageConte xt, webBean);

// Get the current Locale
OAApplicationMo dule am = pageContext.get ApplicationModu le(webBean);
AppsContext appscontext =
((OADBTransacti onImpl)am.getOA DBTransaction() ).getAppsContex t();
String locale = null;
try
{
String as[] = OAHelper.getISO Codes(appsconte xt, appscontext.get CurrLangCode()) ;
locale = as[0]+"-"+as[1] ;
}
catch(SQLExcept ion sqlexception)
{
throw new OAException(sql exception.getMe ssage(), (byte)0);
}

// Set the page context parameter required for datasource BlobDomain.
pageContext.put Parameter("p_Da taSource", "BlobDomain");
pageContext.put Parameter("p_Da taSourceCode", "EmpDataDefinit ion");
pageContext.put Parameter("p_Da taSourceAppsSho rtName", "AK");
pageContext.put Parameter("p_XD ORegionHeight", "700");
pageContext.put Parameter("p_Te mplateCode", "Emp_Template") ;
pageContext.put Parameter("p_Te mplateAppsShort Name", "AK");
pageContext.put Parameter("p_Lo cale", locale);
}


public void processFormRequ est(OAPageConte xt pageContext, OAWebBean webBean)
{
super.processFo rmRequest(pageC ontext, webBean);
OAApplicationMo dule am = pageContext.get ApplicationModu le(webBean);

// Handle the Run button event.
if(pageContext. getParameter("G o") != null)
{

String deptNo = pageContext.get Parameter("dept no");
System.out.prin tln("Department Number: " + deptNo);

String outType = pageContext.get Parameter("Outp utType");


Serializable params[] = {deptNo};

// Generate the Data XML. The data xml should contain the employees of the specified dept
// number
XMLNode xmlNode = (XMLNode) am.invokeMethod ("getDeptEmpDat aXML",params);

System.out.prin tln(xmlNode);

try{
// Create a blob object and add the data xml to it.
BlobDomain blob = new BlobDomain();
OutputStream os = blob.getBinaryO utputStream();
xmlNode.print(o s);
System.out.prin tln("After XMLNode Print");
os.close();
pageContext.put SessionValueDir ect("XML_DATA_B LOB", blob);
System.out.prin tln(" After Put session Value direct");

/* Properties pr = new Properties();

String redirectURL = DocumentHelper. getOutputURL(pa geContext,
APP_SHORT_NAME,
TEMPLATE_CODE,
//result.getBin aryStream(),
blob.getBinaryS tream(),
outType,
pr,
"en",
"US" );


OAHTMLWebBean outRegion = (OAHTMLWebBean) createWebBean(p ageContext,HTML _WEB_BEAN, null, "IFRAME");
outRegion.setHT MLAttributeValu e("src",redirec tURL);
outRegion.setHT MLAttributeValu e("width", "100%");
outRegion.setHT MLAttributeValu e("height", "60%");
outRegion.setHT MLAttributeValu e("title",TEMPL ATE_CODE);
outRegion.setHT MLAttributeValu e("name",TEMPLA TE_CODE);
pageContext.get PageLayoutBean( ).addIndexedChi ld(outRegion);* /

}
catch(Exception e)
{
throw new OAException(e.g etMessage(), (byte)0);
}
}
}


}


Please help me in resolving this issue.

Thanks
Sateesh.
Quote
0 #14 akhil Kumar 2010-06-03 09:52
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."

Pleas e suggest.

Thank s
Akhil
Quote
0 #15 sm 2010-08-02 13:57
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.

T hanks,
Quote
0 #16 sm 2010-08-26 13:44
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..
Quote
0 #17 Sujay 2010-11-18 21:14
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.

Howe ver, When we render the same field by deploying into applications,
w e 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:

BlobDoma in xmlData = new BlobDomain(XMLS tring.getBytes( ) );
redirectURL = DocumentHelper. getOutputURL(
p ageContext
,"XX "
,templateName
,xmlData.getBi naryStream()
," PDF"
,null
,"en "
,"US"
);

Not sure if this conversion is converting the bullet points into ???

Any help in this regard will be highly appreciated.

A lso, Can we rename the PDF File generated ???

Thanks in advance.
Sujay
Quote
0 #18 Dave 2012-06-21 19:05
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!
Quote

Add comment


Security code
Refresh

Search Trainings

Fully verifiable testimonials

Apps2Fusion - Event List

<<  Apr 2024  >>
 Mon  Tue  Wed  Thu  Fri  Sat  Sun 
  1  2  3  4  5  6  7
  8  91011121314
15161718192021
22232425262728
2930     

Enquire For Training

Fusion Training Packages

Get Email Updates


Powered by Google FeedBurner