SAP Knowledge Base Article - Public

1469913 - How to retrieve the source document report template properties from a publication instance?

Symptom

How to retrieve the source document report template properties from a publication instance?

Environment

  • Business Objects Enterprise XI R2
  • Business Objects Enterprise XI 3.x

Resolution

Use the following hava code that retrieves the SI_ID of the original report template source document. Once you have the SI_ID, you can get all the properties.

<%@ page import = "com.crystaldecisions.sdk.exception.SDKException,
                   com.crystaldecisions.sdk.framework.*,
                   com.crystaldecisions.sdk.occa.infostore.*,
                   java.util.*,
                   com.crystaldecisions.sdk.properties.*"                 
%><%
String username = "Administrator";
String password = "<admin password>";
String cmsname  = "<cms name>";
String authType = "secEnterprise";
IEnterpriseSession enterpriseSession  = null;

try
{
 enterpriseSession = CrystalEnterprise.getSessionMgr().logon(username, password, cmsname, authType);
 IInfoStore infoStore = (IInfoStore)enterpriseSession.getService("", "InfoStore");
 IInfoObjects oInfoObjects = (IInfoObjects)infoStore.query("SELECT * FROM CI_INFOOBJECTS WHERE SI_ID = <SI_ID of the publication instance>");
 IInfoObject obj = (IInfoObject) oInfoObjects.get(0);
 int num_of_docs = ((Integer)((IProperties)obj.properties().getProperty("SI_ARTIFACTS_SOURCEDOC").getValue()).getProperty("SI_TOTAL").getValue()).intValue();
 for(int i=1;i <= num_of_docs; i++)
 {
  int templateID = ((Integer)((IProperties)obj.properties().getProperty("SI_ARTIFACTS_SOURCEDOC").getValue()).getProperty(String.valueOf(i)).getValue()).intValue();
  IInfoObject templateObject = (IInfoObject)infoStore.query("SELECT * FROM CI_INFOOBJECTS WHERE SI_ID =" + templateID).get(0);
  //templateID is the SI_ID of the original report template.

 }
 
}
catch(SDKException e)
{
 out.println(e.toString());
}
finally
{
 if (enterpriseSession != null)
  enterpriseSession.logoff();

%>

Keywords

KBA , BI-DEV-JAV , BI Software Development Kits (SDKs) - Java , How To

Product

SAP Crystal Reports XI