javabusiness-objectswebibusiness-objects-sdk

How to read union and combined Webi reports with Java BO SDK?


I need to read Webi reports metadata information which has tables and columns. I can able to read few Webi reports metadata info, but for combined and union Webi reports I am not able to read any metadata data information, I am getting query null for this kind of reports.

Can any one please let me know how can I read metadata?

Code:

String query="SELECT * FROM CI_INFOOBJECTS WHERE SI_KIND in('WEBI') AND SI_INSTANCE = 0 AND SI_ANCESTOR = 23";

sessionMgr = CrystalEnterprise.getSessionMgr();
enterpriseSession = sessionMgr.logon(username,password,ip,"secEnterprise");
reportEngines = (ReportEngines) enterpriseSession.getService("ReportEngines");
ReportEngine wiRepEngine(ReportEngine)reportEngines.getService(
    ReportEngines.ReportEngineType.WI_REPORT_ENGINE);
IInfoStore infoStore = (IInfoStore) enterpriseSession.getService("InfoStore");


IInfoObjects infoObjects = (IInfoObjects) infoStore.query(query);
System.out.println(infoObjects.size());

for (int i =0; i<infoObjects.size(); i++)
{
    IInfoObject report = (IInfoObject)infoObjects.get(i);
    widoc = wiRepEngine.openDocument(report.getID());
    providers = (DataProviders) widoc.getDataProviders();
    for(int prov=0; prov<providers.getCount(); prov++)
    {
        DataProvider providername = providers.getItem(0);
        DataSource datasource= providername.getDataSource();
        String universename=datasource.getName();
        Query providetgetQuery=providername.getQuery();
        System.out.println("Query:-"+providername.getQuery());
        for(int k=0; k<providetgetQuery.getResultObjectCount(); k++)
        {
            providerQueryChild=providetgetQuery.getResultObject(k);
            System.out.println("Columns:-"+providerQueryChild);
            TreeNode providerQueryparent=providerQueryChild.getParent();
            System.out.println("Tables:-"+providerQueryparent);
        }
    }
}

Solution

  • In BO 3.1:

    Instead:

    Query providetgetQuery=providername.getQuery();
    

    try this:

    Query providetgetQuery;
    if (providername.hasCombinedQueries()) {
        providetgetQuery = (Query) providername.getCombinedQueries().getQueryNodeAt(0);
    } else {
        providetgetQuery = providername.getQuery();
    }
    

    In BO 4.0:

    At the moment this part of Report SDK is unavailable. Look what is available: http://help.sap.com/businessobject/product_guides/boexir4/en/xi4_rebean_omd.pdf

    It should be available in BO 4.1: http://scn.sap.com/community/bi-platform/blog/2012/11/18/what-is-coming-in-businessobjects-bi41-customer-validation-asug-webcast