Showing results for 
Search instead for 
Did you mean: 

Chnage Report Owner

0 Kudos

Hi Forum Members

I saw this in Sap Ideas List Is any of the forum members develop any code and try this..

This is the one i saw in web


When a users leaves the company, we need to transfer ownership of all reports to another user. In our security model, non-admin users do not have the right to modify a report for which they are not they owner. Also, we get a number of users that change their name (married, divorced.. other). Currently, we have to copy all reports owned by their "Old" name into a folder, then they have to use their "new" name/userid to perform "Save As" for each one of them. This is VERY time consuming as we have users with dozens and even hundreds (power users) of reports. I get this request 30-50 times a year.

When a user is removed from the system, all public folder reports become owned by Administrator. So some of the code for this has already exists. THIS WOULD BE AWESOME FUNCTIONALITY!! I have spoken with many other BO admins that have this as one of the top 5 on their wish list.


I find some code on Bo forum , but when irun it didnt give any error but it didnnt do any this.

I comile this java to jar and call this jar file through Cmc console as a program file and schedule it.

It say success but it didnt change the owner of the report If some one have an idea chanck this code


package com.programobject;


import com.crystaldecisions.sdk.exception.SDKException;

import com.crystaldecisions.sdk.framework.IEnterpriseSession;

import com.crystaldecisions.sdk.occa.infostore.IInfoStore;

import com.crystaldecisions.sdk.occa.infostore.IInfoObject;

import com.crystaldecisions.sdk.plugin.desktop.program.IProgramBaseEx;

public class JavaProgramObject_1 implements IProgramBaseEx


public void run(IEnterpriseSession enterpriseSession,IInfoStore infoStore,IInfoObject programInfoObject,java.lang.String objectID,java.lang.String[] args) throws SDKException

public class OwnerChanger {

public static void main(String[] args) throws Throwable{

ISessionMgr sm = CrystalEnterprise.getSessionMgr();

// args[] contains user, password, CMS host name and authentication type

IEnterpriseSession es = sm.logon(args[0], args[1], args[2], args[3]);

IInfoStore infoStore = (IInfoStore)es.getService("InfoStore");

// Get the ID of the new owner

String newOwnName = "kaboorva";

String query = String.format("select si_name, si_id from ci_systemobjects where si_kind = 'user' and si_name like '%kttao%'", newOwnName);

IInfoObject newOwner = (IInfoObject)infoStore.query(query).get(0);

int newOwnerId = newOwner.getID();

// Query for the objects whose ownership should be changed

IInfoObjects objsToChange = infoStore.query("select si_id, si_name, si_owner, si_ownerid from ci_infoobjects where SI_KIND='webi' and SI_OWNER = 'testy' and SI_INSTANCE=0");

for (Object o : objsToChange ) {

IInfoObject objToChg = (IInfoObject)o;

String oldOwner =;

// Set new owner ID. Note that changing CePropertyID.SI_OWNER has no effect; SI_OWNERID must be changed instead, newOwnerId);

System.out.format("Changed owner on %s: %s -> %s%n", objToChg.getTitle(), oldOwner, newOwnName);


System.out.println("Saving changes...");



infoStore = null;






Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

Hi Aasavari

Tnanks for the info

In my code i already have this line

public void run(IEnterpriseSession enterpriseSession,IInfoStore infoStore,IInfoObject programInfoObject,java.lang.String objectID,java.lang.String[] args) throws SDKException

But i think this is not an issue , My code is running but it didnt do any thing


0 Kudos

you just have the skeleton for run method but all your code is in main() method. When you schedule the program object it runs the code that is in the run method and not in the main. In fct you need not even have main method in your class. So you need to put your code in run() and not in main().

0 Kudos

You don't seem to be implementing run() method which is required.

public void run(IEnterpriseSession oEnterpriseSession, IInfoStore oInfoStore, String args[])
// your code goes here.
//you already have current IEnterpriseSession and IInfoStore Object, so you can straight away query and change owner.

You need not call logoff() towards the end of this method.

Edited by: Aasavari Bhave on Jan 31, 2012 9:39 AM

Edited by: Aasavari Bhave on Jan 31, 2012 9:40 AM