Skip to Content
Author's profile photo Prithviraj Shekhawat

Java Enterprise BE 14 Get Webi Report on OLAP Connections

This document provides a way to get the list of web intelligence documents based on OLAP connections(si_kind=’CommonConnection’) using Business Intelligence platform Java SDK.

For more scripts and information on how to run these scripts refer to the blog avaiable here:

http://scn.sap.com/people/shawn.penner/blog/2013/06/04/scripts-and-samples

Below is the Java Server Pages (JSP) sample

Notes:

•You would need to change the userName, password, cmsName  to the values specific to your enterprise server in the provided sample code.

Get List Of Webi on BICS Connection

<html>

<body>

<%@ page import=”com.crystaldecisions.sdk.framework.*”%>

<%@ page import=”com.crystaldecisions.sdk.occa.infostore.*”%>

<%@ page import=”com.crystaldecisions.sdk.properties.*” %>

<%@ page import=”com.crystaldecisions.sdk.plugin.desktop.folder.*” %>

<%@ page import=”java.io.*”%>

<TABLE id=”htmlTable” BORDER=”1″ cellpadding=”0″ cellspacing=”0″   width=”90%”  class=”table” align=”center”>

<tr class=”table_header”>

<td>CommonConnection</td><td>Report ID</td><td>Report Name</td><td>Report Path</td>

</tr>

<%

  //Enter Username

  String username = “administrator”;

  //Enter User password

  String password = “password”;

  //Enter CMS Name

  String cmsname = “localhost:6400”;

  String authtype = “secEnterprise”;

  //Enter the objdect which you need to search in the webi reports

  IEnterpriseSession oEnterpriseSession=null;

  try

  {

  oEnterpriseSession = CrystalEnterprise.getSessionMgr().logon(username, password, cmsname, authtype);

  IInfoStore oInfoStore = (IInfoStore)oEnterpriseSession.getService(“”,”InfoStore”);

  String query = “select si_id,si_name from ci_appobjects where si_kind=’CommonConnection'”;

  IInfoObjects oInfoObjects = oInfoStore.query(query);

  for(int i=0;i<oInfoObjects.size();i++)

  {

  IInfoObject oInfoObject = (IInfoObject) oInfoObjects.get(i);

  out.println(“<tr><td>”+oInfoObject.getTitle()+”</td>”);

  String webiDocQuery=”select top 1000 si_name,si_id,si_parentid from ci_appobjects,ci_infoobjects where PARENTS(\”si_name=’CommonConnection-Document’\”,\”si_name='” + oInfoObject.getTitle() + “‘” + “\”)”;

  IInfoObjects webiDocObjects= oInfoStore.query(webiDocQuery);

  for(int a=0;a<webiDocObjects.size() ;a++)

  {

  IInfoObject webiDocObject=(IInfoObject)webiDocObjects.get(a);

  out.println(“<td>”+ webiDocObject.getID() + “</td><td>”+ webiDocObject.getTitle() + “</td>”);

  //if(a != (webiDocObjects.size()-1))

  IProperties prop = webiDocObject.properties();

  IProperty getProp = prop.getProperty(“SI_PARENTID”);

  String FolderID = getProp.toString();

  IInfoObjects folder = oInfoStore .query(“select si_id,si_name,si_parentid,si_path from ci_infoobjects where si_id=” + FolderID);

  IInfoObject ifolder=(IInfoObject)folder.get(0); 

  if(ifolder.getKind().equals(“Folder”))

  {

   IFolder iifolder=(IFolder)ifolder;

   String finalFolderPath=””;

   if(iifolder.getPath()!= null)

   {

    String path[]=iifolder.getPath();

    for(int fi=0;fi<path.length;fi++)

    {

     finalFolderPath = path[fi] + “/” + finalFolderPath;

    }

    finalFolderPath = finalFolderPath + iifolder.getTitle();

   }

   else

   {

    finalFolderPath=finalFolderPath+iifolder.getTitle();

   }

   out.println(“<td>” + finalFolderPath + “</td></tr>”);

  }

  else if((ifolder.getKind().equals(“FavoritesFolder”)))

  {

   out.println(“<td><b>FavoritesFolder</b>  ::  ” + ifolder.getTitle() + “</td></tr>”);

  }

  else if((ifolder.getKind().equals(“Inbox”)))

  {

   out.println(“<td><b>Inbox</b>  ::  ” + ifolder.getTitle() + “</td></tr>”);

  }

  else if((ifolder.getKind().equals(“ObjectPackage”)))

  {

   //out.println(“<td><b>ObjectPackage</b>  ::  ” + ifolder.getTitle() + “</td></tr>”);

   IProperties prop1 = ifolder.properties();

  IProperty getProp1 = prop1.getProperty(“SI_PARENTID”);

  String FolderID1 = getProp1.toString();

  IInfoObjects folder1 = oInfoStore.query(“select * from ci_infoobjects where si_id=” + FolderID1);

  IInfoObject ifolder1=(IInfoObject)folder1.get(0); 

  if(ifolder1.getKind().equals(“Folder”))

  {

   IFolder iifolder1=(IFolder)ifolder1;

   String finalFolderPath1=””;

   if(iifolder1.getPath()!= null)

   {

    String path[]=iifolder1.getPath();

    for(int j=0;j<path.length;j++)

    {

     finalFolderPath1= path[j] + “/” + finalFolderPath1;

    }

    finalFolderPath1 = finalFolderPath1 + iifolder1.getTitle()+”/”+ifolder.getTitle();

   }

   else

   {

    finalFolderPath1=finalFolderPath1+iifolder1.getTitle()+”/”+ifolder.getTitle();

   }

   out.println(“<td>” + finalFolderPath1 + “</td></tr>”);

  }

  }

  out.println(“<tr><td></td>”);

  }

  out.println(“<td></td><td></td><td></td></tr>”);

  }

  }

  catch(Exception e)

  {

  out.println(e);

  }

  finally

  {

  oEnterpriseSession.logoff();

  }

%>

</table>

</body>

</html>

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.