The current public BO BI 4.0 SDK does not include any features that allows to list objects used in a Webi 4.0 document or access variables. But this is still possible.
UPDATE: Please consider 4.1 RESTful Web Services SDK Developer Guides and API References http://scn.sap.com/docs/DOC-27465. It might be more convenient than hacking internal SDKs.
The necessary libraries:
- C:\Program Files (x86)\SAP BusinessObjects\Tomcat6\webapps\BOE\WEB-INF\eclipse\plugins\webpath.AnalyticalReporting\web\WEB-INF\lib\adv_ivcdzview.jar
- C:\Program Files (x86)\SAP BusinessObjects\Tomcat6\webapps\BOE\WEB-INF\eclipse\plugins\webpath.AnalyticalReporting\web\WEB-INF\lib\webi_client_toolkit.jar
- C:\Program Files (x86)\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.0\java\lib\* (without subfolders)
import java.util.List; import java.util.Locale; import com.businessobjects.adv_ivcdzview.Utils; import com.businessobjects.rebean.wi.model.engine.IDocumentInstance; import com.businessobjects.rebean.wi.services.IDocumentInstanceManagementService; import com.businessobjects.sdk.core.Core; import com.businessobjects.sdk.core.context.IContext; import com.crystaldecisions.sdk.exception.SDKException; import com.crystaldecisions.sdk.framework.CrystalEnterprise; import com.crystaldecisions.sdk.framework.IEnterpriseSession; import com.crystaldecisions.sdk.framework.ISessionMgr; import com.crystaldecisions.sdk.occa.infostore.IInfoObject; import com.crystaldecisions.sdk.occa.infostore.IInfoObjects; import com.crystaldecisions.sdk.occa.infostore.IInfoStore; import com.sap.sl.dictionary.DictionaryExpression; import com.sap.sl.dictionary.Variable; import com.sap.webi.client.toolkit.Deployment; import com.sap.webi.client.toolkit.LoginKey; import com.sap.webi.client.toolkit.SessionContext; import com.sap.webi.client.toolkit.reporting.ReportDictionaryHelper; public class Program2 { public static void main(String[] args) throws Exception { IEnterpriseSession enterpriseSession = null; try { System.out.println("Connecting..."); ISessionMgr sessionMgr = CrystalEnterprise.getSessionMgr(); enterpriseSession = sessionMgr.logon( "Administrator", "", "localhost", "secEnterprise"); // Do some magic String serializedSession = enterpriseSession.getSerializedSession(); SessionContext sessionContext = Utils.getSessionContextManager() .matchSessionContext(Deployment.DHTML, serializedSession, true); Locale localLocale = Locale.getDefault(); sessionContext.getLoginInfo().set(LoginKey.LOCALE, localLocale); sessionContext.logonWithSerializedSession(); IContext context = sessionContext.getCoreContext(); IDocumentInstanceManagementService documentInstanceManagementService = Core.getService(IDocumentInstanceManagementService.class); // Get the list of webi documents IInfoStore infoStore = (IInfoStore) enterpriseSession.getService("InfoStore"); String query = "select SI_NAME, SI_ID from CI_INFOOBJECTS " + "where SI_KIND = 'Webi' and SI_INSTANCE=0"; IInfoObjects infoObjects = (IInfoObjects) infoStore.query(query); for (Object object : infoObjects) { IInfoObject infoObject = (IInfoObject) object; if (getInfoObjectPathAndTitle(infoObject).startsWith("/")) { System.out.println("REPORT: " + infoObject.getTitle()); IDocumentInstance doc = documentInstanceManagementService .openDocument(context, infoObject.getID()); List list = ReportDictionaryHelper .getDictionaryObjectsFlatList(context, doc); if (list.size() > 0) { System.out.println("OBJECTS:"); for (DictionaryExpression expr:list) { System.out.println(expr.getName()); } } List vars = ReportDictionaryHelper.getDocumentVariables(context,doc); if (vars.size() > 0) { System.out.println("VARIABLES:"); for (Variable var:vars) { System.out.println(var.getName()); } } documentInstanceManagementService.closeDocument(context, doc); System.out.println(); } } } catch (SDKException ex) { ex.printStackTrace(); } finally { if (enterpriseSession != null) enterpriseSession.logoff(); } System.out.println("Finished!"); } public static String getInfoObjectPath(IInfoObject infoObject) throws SDKException { String path = ""; while (infoObject.getParentID() != 0) { infoObject = infoObject.getParent(); path = "/" + infoObject.getTitle() + path; } return path; } public static String getInfoObjectPathAndTitle(IInfoObject infoObject) throws SDKException { return getInfoObjectPath(infoObject) + "/" + infoObject.getTitle(); } }







BO XI 3.1 executable of InfoStore Query Builder (zip)












