Change the preferences of user in bulk using a JSP file via SDK
We try to find a solution which is optimal, automatic and efficient in solving a repetitive task. One such problem I came across and posting the solution for the benefit of the community.
Problem: We have more than 2000 users in our BO platform and one of the request was to change the preference of all the users to View and Modify Webi using HTML mode as it’s lighter and gives faster performance compared to Applet and Desktop mode.
It would be tedious task to ask all the users to go in and change the preference manually. Even if it would take 3 minutes for one user to change the preference and same we are talking about approx. 6000+ minutes plus additional customer complaints. So we decided to write a utility which will do the job for us in 10 minutes.
Here is the SDK code for the same:
1.Create a jsp file using the below code – The logic is pretty simple. Login to CMS, use the preference of the model user (in the below example Administrator user) and assign to all other users. Clean and simple.
<%@ page import = “com.crystaldecisions.sdk.plugin.desktop.user.*,
String username = “Admin User”;
String password =Pwd”;
String cmsname = “CMS name”;
String authtype =”Authentication Type”;
IEnterpriseSession oEnterpriseSession = null;
oEnterpriseSession = CrystalEnterprise.getSessionMgr().logon(username, password, cmsname, authtype);
IInfoStore oInfoStore = (IInfoStore)oEnterpriseSession.getService(“”,”InfoStore”);
String query = “select * from ci_systemobjects where si_name=’Administrator’ and si_progid=’CrystalEnterprise.User'”; // User whose preference to be copied
IUser adminUser = (IUser)oInfoStore.query(query).get(0);
String adminInfoViewPref = adminUser.getProfileString(“desktopsettings”); //Preference
query = “select * from ci_systemobjects where si_progid = ‘CrystalEnterprise.User’ and si_name = ‘User1, User 2….’ “;// Users whose preference needs to be changed.
// You can have ageneric query as well e.g like ‘% matching User string%’
IInfoObjects oInfoObjects = oInfoStore.query(query);
if(oInfoObjects.size() < 1)
out.println(“no users found!”);
for(int i=0; i < oInfoObjects.size(); i++)
IUser oUser = (IUser)oInfoObjects.get(0);
if(oEnterpriseSession != null)
2. Save the code as Name_of_the_JSP_file.jsp file. Run this Jsp page on tomcat server by creating a new web application. There easy and simple steps to do that –
a. Create a folder called “Name of Your Choice” at tomcat server location D:\Program Files (x86)\SAP BusinessObjects\TomcatX.X.XX\webapps
b. Copy the JSP file to BO tomcat server at the location(the folder you just created) D:\Program Files (x86)\SAP BusinessObjects\TomcatX.X.XX\webapps\Folder created in step a
c. Create a folder called “WEB-INF” inside the folder “The one you created in step a” and copy the folder “lib” from D:\Program Files (x86)\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.X\java — path inside the WEB-INF folder.
d. Copy all the files from D:\Program Files (x86)\SAP BusinessObjects\TomcatX.X.XX\webapps\Folder created in step a\WEB-INF\lib\external to D:\Program Files (x86)\SAP BusinessObjects\TomcatX.X.XX\webapps\Folder created in step a\WEB-INF\lib
e. Restart the tomcat server and utility is good to be executed.
f. To Execute:
Go to url http://localhost:8080/folder Name/Name_of_the_JSP_file.jsp
We have tested this solution in SAP BO 4.0 and BO 4.1 versions over multiple service packs. I think this should work fine in 4.2 as well but we have not tested it yet.