Web Intelligence documents use one or many universes. Sometimes it is necessary to change universes for a bunch of reports. Changing universe might be very difficult if you need to modify dozens of documents. Luckily it is possible to utilize BusinessObjects Report Engine Java SDK.
There is a number of Webi documents in a folder which use a number of universes. The task is to make a copy of these on the same BOE server.
It is easy to copy documents (in CMC) and universes (using Universe Designer. The complex problem is to change a copied document to use the copied universes.
The manual procedure of changing universe for a document is the following:
- Open Webi document in Web Intelligence in edit mode.
- Click Edit query.
- For each query, change universe in the query properties.
- Changing universe you have to confirm mapping. If you change a universe to its copy, you do not need to do anything in this mapping. But just confirming it takes few seconds.
The automated procedure for all documents will do the following:
- Get list of universe IDs that used by the copied documents.
- Get list of all available universes.
- Create a mapping of IDs.
- Map all reports from the original universes to their copies using the mapping.
If you have to modify 5 documents, the writing code might take even more time then do it manually, but anyway coding is more fun then clicking 🙂
If you have to modify 50 documents, think twice before starting manual work.
Java Function
public static boolean changeUniverses(DocumentInstance widoc, HashMap<String, String> mapping) { boolean failed = false; DataProviders dps = widoc.getDataProviders(); HashSet<DataSource> dataSources = new HashSet<DataSource>(); for (int i = 0; i < dps.getCount(); ++i) { DataProvider dp = (DataProvider) dps.getItem(i); dataSources.add(dp.getDataSource()); } for (DataSource ds: dataSources) { String universeId = ds.getUniverseID(); String oldID = universeId; String newID = mapping.get(oldID); System.out.println(oldID + "->" + newID); dps.changeUniverse(oldID, newID, true); if (dps.mustFillChangeUniverseMapping()) { ChangeUniverseMapping unvMapping = dps.getChangeUniverseMapping(); ChangeDataSourceMapping[] dsMappings = unvMapping.getDataSourceMappings(); for (ChangeDataSourceMapping dsMapping : dsMappings) { ChangeDataSourceObjectMapping[] objMappings = dsMapping.getAllMappings(); for (ChangeDataSourceObjectMapping objMapping : objMappings) { if (objMapping.getToObject() == null) { failed = true; } } } dps.setChangeUniverseMapping(); if (widoc.getMustFillContexts()) { failed = true; } widoc.applyFormat(); widoc.refresh(); } if (failed) { return false; } } return true; }
BTW, the universe id is something like:
UnivCUID=ASiM_T4jxmJIj0aKWpbeXro;UnivID=41709;ShortName=Finance;UnivName=Finance
Hi, what lib do I import to use DataProviders?
I’m new to Java and any help is greatly appreciated!
I have circa 500 WebIs that need to be re-pointed to the correct Universes.
LikeLike
com.businessobjects.rebean.wi.DataProviders is in library rebean.wi.jar
You can find the list of the required libraries in the end of the post:
https://bukhantsov.org/2011/08/getting-started-with-businessobjects-java-sdk/
I have uploaded a bit modified version of the tool for remapping:
https://bukhantsov.org/tools/WidRemapping.zip
You will have to change some hardcoded values: server parameters, unvFolder, widocFolder.
LikeLike
Thanks :O)
I’ll take a look at it this week and let you know how I get on…
LikeLike
Hi,
Thanks for the app its just what I’ve been looking for.
I’m not a developer and struggle with code, so was wondering if you could give me instructions on how to run the app as I’m currently getting the error:
Exception in thread “main” java.land.NoClassDefFoundError
I understand that this is saying that it cannot find the class definitions, .classpath file, but how do I make the app see this file or better said the Class it requires?
LikeLike
Sorry, I got further by compiling it using javac. However, now it’s complaining about not being able to find any of the import classes…
All errors are similar to:
C:\Share\Customers\Z (Greenstone)\JavaTool\src\org\bukhantsov\javatool\Program.java:134: cannot
symbol : class DataSource
location: class org.bukhantsov.javatool.Program
for (DataSource ds: dataSources) {
I changed the path in the .classpath file to reflect the path to the jar files on my machine, but that hasn’t helped unfortunately.
I’m using BOE XI 3.1 BTW.
LikeLike
A sort guide how to compile and run from command line
https://bukhantsov.org/2012/01/compiling-and-running-bo-sdk-java-tool-from-command-line/
LikeLike
Hi,
Could this script also run on BI4.0 SP5?
Chris
LikeLike
Nope. The corresponding ReportEngine features are not functional in 4.0. SAP has not released a substitution yet.
LikeLike
Hi,
Thanks for the code posted. I’m using it.
But I have problems with some of my reports. (#DATATYPE, #SYNTAX, #FORMAT)
Looks like they all have merge dimensions.
Using the UI I didn’t get the same problems.
I’m using BOE XI 3.1 SP5 BTW
Can you please help
Thanks
Jud
LikeLike
Hi,
we recently migrated to BI 4.0 SP5
we have the same issue 3 of our unv has corrupted and we have around 100-120 reports based on each report. I’m really struggling to get this fixed and users are eating my head.
we renamed the org UNV to XXX1.UNV and now the unv is responding. The issue is how I repoint all my reports to xxx1.unv ??
————————————————-
Is there a way if you can give me a compiled JSP file that I just rename the CUID and run on my Env to fix all these reports ??
if that is possiable you will be the saver of my life… can you plzzz
Thanks for your great help in advance
Thanks
Balaji Karunakaran
LikeLike
BI 4.0 ReportEngine SDK does not allow to change universe. There is no replacement for that SDK at the moment.
Do you have 3.1 system?
Do you have BIAR with the universes and reports?
LikeLike
Hi,
I have started looking at the challenge of remapping a report from a UNV type universe to a UNX universe this week and have seen many posts, including yours, saying that this is not possible in BI 4.0.
However, APOS have released a tool to do just this, although from their marketing it would appear to be for BI 4.0 SP6 only.
So, my guess is that the SDK finally got updated in SP6 with methods to remap a report to a different universe? Are you able to shed any light on this?
Many thanks
Mike
LikeLike
I am not actively working with SDK lately so I do not have the latest information about this. SAP has definitely been working on the development of their SDK and everything that was not possible will finally be possible soon. I heard that most of the needed functionality will be available in 4.1, and probably in the corresponding SP of 4.0 as well.
LikeLike
Thank you very much for this code and others on your blog. It has been very helpful. I was able to modify it to remap all reports in our repository (10,000+ reports).
If anyone is using this code to remap a large repository, you will have to break up your queries. There is a 1000 object limit on the query. We ran one query that retrieved all user’s personal folders, then looped through each one running a second query to get all of each user’s folder.
Also, avoid any folders that are read only. The “~webintelligence” folder will cause errors if it is included in the remapping. Explicitly exclude it if you are doing user personal folders.
LikeLike
No need to break up queries. You can change default limit using: SELECT TOP 10000 …
LikeLike
Hi Dmytro,
Is it possible to copy a webi report from one folder to another using BO SDK?
Can you please help me understand the approach?
Regards,
Suraj
LikeLike
I assume you first create a copy of an infoobject using IInfoObjects.copy(…) and then save object to infostore
LikeLike
Hi ,
Thanks for the code posted. I’m using it.
But I have problems with some of my reports. (#DATATYPE, #SYNTAX, #FORMAT)
Looks like they all have manually created merge dimensions
Using the UI I didn’t get the same problems.
I’m using BOE XI 3.1 SP5 FP3
Can you please help
Thanks
Gurbachan
LikeLike
I am remapping reports in our repository based on your code. I would recommend changing this line in your code:
widoc = wiRepEngine.openDocument(infoObject.getID());
to
widoc = wiRepEngine.openDocument(infoObject.getID(),true, false);
Using that version of openDocument with the additional parameters will ignore refresh on open. I found that a lot of my users created documents with refresh on open set. This significantly increased the amount of time it took to remap all of the reports.
LikeLike
Sorry, I got the syntax incorrect going from memory. It should be:
OpenDocumentParameters docParam = new OpenDocumentParameters(infoObject.getID(),true,false) ;
widoc = wiRepEngine.openDocument(infoObject.getID(),docParam);
LikeLike