This document provides a way to get the data objects used in a web intelligence document using Report Engine Java SDK.
While running the code, you have to provide a folder id, for which you want all the webi report data objects. This will also bring reports in sub folders.
For more scripts and information on how to run these scripts refer to the blog avaiable here:
shawn.penner/blog/2013/06/04/scripts-and-samples
Below is the Java Server Pages (JSP) sample
Note:
•You would need to change the userName, password, cmsName to the values specific to your enterprise server in the provided sample code.
• The sample code will only run with BO XI 3.1 version of SAP BusinessObjects Platform
Get Webi Document Objects |
---|
<html> <style> .table { margin-bottom: 15px; border-collapse: collapse; } .table_header td { background: #294f7f; padding: 5px 10px; color: rgb(255,255,255); border-top: 1px solid #CBD6DE; border-bottom: 1px solid #ADBECB; font-size: 1.0em; font-weight: bold; } .table_header td { border: 1px solid #CBD6DE; } .row td{ padding: 5px 10px; color: #666666; border: 1px solid #CBD6DE; } .row td { background: #ffffff; } </style> </head> <body> <%@ page import="com.crystaldecisions.sdk.framework.*, com.crystaldecisions.sdk.occa.infostore.*, com.businessobjects.rebean.wi.*, java.io.*" %> <TABLE id="htmlTable" BORDER="1" cellpadding="0" cellspacing="0" width="90%" class="table" align="center"> <tr class="table_header"> <td>Report ID</td><td>Report Name</td><td>Report Objects</td>
</tr> <% //Enter Username String username = "administrator"; //Enter User password String password = ""; //Enter CMS Name String cmsname = "localhost:6400"; String authtype = "secEnterprise"; //Enter the folder if for which you need to retrieve the webi reports objects int report_folder_id=2750278; IEnterpriseSession oEnterpriseSession=null; ReportEngines engines=null; ReportEngine widocRepEngine=null; try { oEnterpriseSession = CrystalEnterprise.getSessionMgr().logon(username, password, cmsname, authtype); engines = (ReportEngines) oEnterpriseSession.getService("ReportEngines"); widocRepEngine = (ReportEngine) engines.getService(ReportEngines.ReportEngineType.WI_REPORT_ENGINE); getReportObjectsInFolder(oEnterpriseSession,widocRepEngine,report_folder_id,out); } catch(Exception e) { out.println(e); } finally { widocRepEngine.close(); engines.close(); oEnterpriseSession.logoff(); } %> </table> </body> </html> <%! private void getReportObjects(IEnterpriseSession oEnterpriseSession,ReportEngine widocRepEngine,int reportID, JspWriter out) throws Exception { DocumentInstance wiDoc = widocRepEngine.openDocument(reportID); ReportDictionary reportDictionary=wiDoc.getDictionary(); for(int a=0;a<reportDictionary.getChildCount() ;a++) { String name=reportDictionary.getChildAt(a).getName(); out.println("<td>"+name+"</td></tr>"); out.println("<tr class=\"row\"><td> </td><td> </td>"); } out.println("<td></td></tr>"); wiDoc.closeDocument(); } private void getReportObjectsInFolder(IEnterpriseSession oEnterpriseSession,ReportEngine widocRepEngine,int reportFolderID, JspWriter out) throws Exception { IInfoStore oInfoStore = (IInfoStore)oEnterpriseSession.getService("","InfoStore"); try { String query = "select si_id from ci_infoobjects where SI_PARENTID="+reportFolderID; IInfoObjects oInfoObjects = oInfoStore.query(query); for(int i=0;i<oInfoObjects.size();i++) { IInfoObject oInfoObject = (IInfoObject) oInfoObjects.get(i); String objectKind1=oInfoObject.getKind(); if(objectKind1.equals("Folder")) { int folderID=oInfoObject.getID(); IInfoObjects boReportInfoObjects=oInfoStore.query("SELECT SI_ID FROM CI_INFOOBJECTS WHERE SI_PARENTID="+folderID); for(int j=0;j<boReportInfoObjects.size();j++) { IInfoObject boReportInfoObject=(IInfoObject)boReportInfoObjects.get(j); String objectKind=boReportInfoObject.getKind(); if(objectKind.equals("Folder")) { getReportObjectsInFolder(oEnterpriseSession,widocRepEngine,boReportInfoObject.getID(),out); } else if(objectKind.equals("Webi")) { out.println("<tr class=\"row\"><td>"+ boReportInfoObject.getID() + "</td><td>"+ boReportInfoObject.getTitle() + "</td>"); getReportObjects(oEnterpriseSession,widocRepEngine,boReportInfoObject.getID(),out); } } } else if(objectKind1.equals("Webi")) { out.println("<tr class=\"row\"><td>"+ oInfoObject.getID() + "</td><td>"+ oInfoObject.getTitle() + "</td>"); getReportObjects(oEnterpriseSession,widocRepEngine,oInfoObject.getID(),out); } } } catch(Exception exe) { out.println(exe); } } %> |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
37 | |
10 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 | |
2 | |
2 |