SAP BusinessObjects - List all reports using a Universe

One of our clients upgraded their Trading System. There was a Universe build on top of the Trading System database and Business Objects reports based on this Universe. As part of the project scoping, our client needed to know quickly what Business Objects reports could potentially be impacted by the upgrade.

Unfortunately, there is no easy way to list the reports using a specific Universe in Business Objects. To achieve this, we used the Business Objects Java SDK.

Here is a simple Java program that lists the reports using a specified Universe.
It takes four arguments:

java ListReportsOfAUniverse Administrator myPassword myCMSName 6400 myUniverse

The program writes the list of reports with their kind (Webi or Deski) to the console.

To compile the code, I used Eclipse Indigo Service Release 2. This code was designed for Business Objects 3.1. To set up your Java environment, add the Business Objects SDK jar files to your classpath. In my case, I’ve added the jar files to the Eclipse reference libraries.

Please note that this is not a Java tutorial. The program is very simple and is only here to illustrate the use of the BO SDK classes to solve the particular problem at hand. You’ll need to enrich it to use it on a production environment (for example add the report folder, encrypt the CMS password, etc).

Here is the code:

// SDK objects
import com.businessobjects.sdk.plugin.desktop.universe.IUniverse;
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.IInfoStore;

public class ListReportsOfAUniverse {
	
	public static void main (String args[]) {
		
		String user 		= args[0]; // for example: Administrator
		String password 	= args[1]; // for example: myPassword
		String CMSName 		= args[2]; // for example: myCMSName
		String CMSPort 		= args[3]; // for example: 6400
		String universeName = args[4]; // for example: myUniverse
		
		String sql = "";
		Iterator itReport;
		IInfoObject infoObject;
		
		try {
			// log on to the CMS
			ISessionMgr sessionMgr = CrystalEnterprise.getSessionMgr(); 
			IEnterpriseSession enterpriseSession = sessionMgr.logon(user, password, CMSName + ":" + CMSPort, "secEnterprise"); 
			
			// get an InfoStore service to query the CMS
			IInfoStore infoStore = (IInfoStore) enterpriseSession.getService("InfoStore");
			
			sql = "SELECT si_id,si_name,si_webi,si_cuid FROM CI_AppObjects WHERE SI_NAME = '" + universeName + "' AND SI_KIND = 'Universe'";
			
			// retrieve the Universe Id from the CMS
			IUniverse  universe = (IUniverse)infoStore.query(sql).get(0);
			
			// get the Webi and Deski Ids of the reports using the Universe 
			itReport = universe.getWebis().iterator();
			
			// loop over the reports
			while (itReport.hasNext()) {
				// retrieve the Report Name and Kind (Webi or FullClient) 
				sql = "SELECT SI_ID,SI_NAME,SI_KIND FROM CI_INFOOBJECTS WHERE SI_INSTANCE = 0 AND SI_ID = " + itReport.next().toString(); //itReport.next() contains report ID
				infoObject = (IInfoObject)infoStore.query(sql).get(0);
				
				// simple output to console: Report Name - Report Kind
				System.out.println(infoObject.getTitle() + " - " + infoObject.getKind());
			}
		
			// log off from the CMS
			enterpriseSession.logoff();

		}
		catch (Exception e) {
			System.err.println(e.toString());	
		}
	}
}

Comments   

 
0 #4 profile 2016-12-17 11:05 Quote
 
 
0 #3 HBKQaptcha 2014-09-14 22:46
Fantastic Article. Thanks for writing this, it is remarkably good written and published.
I will keep checking back for more content from you.
Quote
 
 
-1 #2 Mouli 2013-10-10 10:25
Hi,
Useful info... thanks...
I have created a universe to achieve the same requirement by hitting CMS DB.
Quote
 
 
0 #1 Nisha 2013-07-18 12:09
Great piece of code, really usefull. Thanks.
Quote
 

Add comment


Security code
Refresh