I have encountered quite a few issues related to webi reports linking to wrong universe, or even losing connection to the universe completely. While most of these issues can be fixed by opening up the webi reports in the webi designer and remapping the universes through that - it can be difficult and very time consuming to apply that fix when you have hundreds or thousands of webi reports that need to be repaired. The set of scripts below were created to resolve issues related to webi reports and universe mapping. These scripts were designed to work with BOE XI R3. They will not work in BI4.
The code given below can be very destructive if not used properly. Please ensure that you have made a backup of your CMS database and your Input and Output FRS prior to running any code.
This code is based on the batch scripting template found here: http://scn.sap.com/docs/DOC-38618
For other scripts and information on how to run these scripts see here:
shawn.penner/blog/2013/06/04/scripts-and-samples
This first script was created to fix webi reports that had no universe in the SI_UNIVERSE property. It assumes that the SI_UNIVERSE property exists, but that there are no universes listed in it. The script first loops through each dataprovider in the webi report, retrieves the universe name, and then searches the enterprise system for a universe with a matching name. If it finds one, it maps the universe to the dataprovider.
Auto-Detect and Remap |
---|
<%@ page import = "com.crystaldecisions.sdk.exception.SDKException,
IEnterpriseSession enterpriseSession = null; // Log onto Enterprise // The SI_ID to start at when searching IProperty boProperty_SI_UNIVERSE = null; for(;;) { // Loop through all objects // If there are no more objects then we're done. for(Iterator boCount = boInfoObjects.iterator() ; boCount.hasNext() ; ) { // Are there any universes mapped to this webi report DataProvider boDataProvider = null; <%! String folderPath = ""; if (boInfoObjects.size()>0) { if (boInfoObject.properties().getProperty("SI_PATH") != null) { for (int i=((Integer) boProperties_SI_PATH.getProperty("SI_NUM_FOLDERS").getValue()).intValue(); i>0; i--) { folderPath = boInfoObject.getKind() + "</TD><TD>" + folderPath; return folderPath; public void writeToLog(String msg) { |
This next script was designed to remap all webi reports that used a specific universe and point them at a different universe. They key thing to note with this script is how it identifies which universe to look for. The way it does this is by looking for something unique in the SI_WEBI_DOC_PROPERTIES infoobject.
e.g.
SI_WEBI_DOC_PROPERTIES LIKE '%UnivCUID=AVHuOHKBm5lFkr3KcJkfk_0%'
The % are wildcard characters which allow the UnivCUID string to occur anywhere in the SI_WEBI_DOC_PROPERTIES value.
Batch Search and Replace |
---|
<%@ page import = "com.crystaldecisions.sdk.exception.SDKException, IEnterpriseSession enterpriseSession = null; // Log onto Enterprise // The SI_ID to start at when searching String universeID = "12345"; // Target Universe IProperty boProperty_SI_UNIVERSE = null; // Retrieve info about target universe for(;;) { // Loop through all objects // If there are no more objects then we're done. for(Iterator boCount = boInfoObjects.iterator() ; boCount.hasNext() ; ) { // Obtain Universe Information for this webi report DocumentInstance boDocumentInstance = boReportEngine.openDocument(boReport.getID()); <%! String folderPath = ""; if (boInfoObjects.size()>0) { if (boInfoObject.properties().getProperty("SI_PATH") != null) { for (int i=((Integer) boProperties_SI_PATH.getProperty("SI_NUM_FOLDERS").getValue()).intValue(); i>0; i--) { folderPath = boInfoObject.getKind() + "</TD><TD>" + folderPath; return folderPath; public void writeToLog(String msg) { |
This third script is designed to handle individual reports. It allows you to pass in parameters specifying a webi report, universe ID, and the index of the connection that you want to change. It is designed to accept those parameters via querystring so you can automate it a bit if needed.
An example URL to call this script would be:
http://localhost:8080/testApp/remapWebi.jsp?reportID=918&universeID=1093&ConnectIndex=0
You can specify default values in the script which will be used if you leave out the parameters from the URL.
Remap Single Webi Report |
---|
<%@ page import = "com.crystaldecisions.sdk.exception.SDKException, // Default values // Get the params from the query string if they exist. If not - use the values set above. if (request.getParameter("universeID")!=null) { if (request.getParameter("ConnectIndex")!=null) { IEnterpriseSession enterpriseSession = null; // Log onto Enterprise String query_webi = "SELECT TOP 1 SI_ID FROM CI_INFOOBJECTS WHERE SI_INSTANCE = 0 And SI_Kind = 'Webi' AND SI_ID=" + docID; String query_universe = "SELECT TOP 1 SI_NAME, SI_CUID, SI_SHORTNAME FROM CI_APPOBJECTS WHERE SI_Kind = 'Universe' AND SI_ID=" + universeId; String newUniverseId = null; if ((boInfoObjects_webi.size() > 0) && (boInfoObjects_universe.size() > 0)) { boInfoObject_webi = (IInfoObject) boInfoObjects_webi.get(0); ReportEngines boReportEngines = (ReportEngines) enterpriseSession.getService("ReportEngines"); DocumentInstance boDocumentInstance = boReportEngine.openDocument(boInfoObject_webi.getID()); out.print("<TABLE BORDER=1>"); boDocumentInstance.save(); %> |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
26 | |
22 | |
19 | |
13 | |
10 | |
9 | |
9 | |
8 | |
7 | |
7 |