Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 9656

Schedule a report Webi on behalf of other users using Java SDK's.

$
0
0

Our team is working on SDK, Web Services.

 

 

We are on 4.0 SP5.

 

 

I am trying to find a solution or code for this option.

 

How to Schedule a report (Crystal / Webi / Deski) on behalf of other users using Java SDK's.

 

  I found a SAP note 1671515 but when we try to implement it says compatible issue.

 

Could some on help us with the code in 4.0 SP5 for web services SDK.

 

Here is my scenrio:

 

Super User schedules a report for standard users.

 

 

 

Below code didn't worked.

 

 

 

 

To Schedule a report on behalf of other user, please perform the following steps:

 

 

1. Give full control rights from CMC to the user which will perform scheduling on behalf of other user.

 

 

2. Try the following code

 

 

<%@ page import = "java.util.*,

                com.crystaldecisions.sdk.framework.*,

                com.crystaldecisions.sdk.plugin.desktop.report.*,

                com.crystaldecisions.sdk.plugin.destination.diskunmanaged.*,

                com.crystaldecisions.sdk.plugin.desktop.common.*,

                com.crystaldecisions.sdk.exception.*,

                com.crystaldecisions.sdk.occa.security.*,

                com.crystaldecisions.sdk.occa.infostore.*"

%>

<%

IInfoStore iStore = null;

IInfoObjects oInfoObjects =null;

IInfoObject oInfoObject = null;

IEnterpriseSession es = null;

IInfoObjects oInfoObjects1 =null;

IInfoObject oInfoObject1 = null;

IReport oReport = null;

ISchedulingInfo schedinfo = null;

 

 

String cms = "localhost:6400";

String user = "TestSchedule"; // User which will perform the task of scheduling on others behalf

String password = "";

String authType = "secEnterprise";

try {

es=CrystalEnterprise.getSessionMgr().logon(user,password,cms,authType);

 

}

catch(SDKException e)

{

out.println("failed to logged in");

  return;

}

 

 

try

{

 

iStore= (IInfoStore)es.getService("","InfoStore");

// Query to retreive a Crystal Report

oInfoObjects = (IInfoObjects)iStore.query("SELECT * FROM CI_INFOOBJECTS WHERE SI_PROGID='CrystalEnterprise.Report' AND SI_INSTANCE=0 AND SI_NAME='World Sales Report'");

oInfoObject = (IInfoObject)oInfoObjects.get(0);

oReport = (IReport)oInfoObject;

 

 

schedinfo= oInfoObject.getSchedulingInfo();

// Query to get the ID of the user on whose behalf we have to schedule.

oInfoObjects1 = iStore.query("Select * from ci_systemobjects where si_kind = 'user' and si_name='Guest'");

oInfoObject1 = (IInfoObject)oInfoObjects1.get(0);

int ID = oInfoObject1.getID(); 

out.println(ID);

 

schedinfo.setScheduleOnBehalfOf(ID);  // method to schedule on behalf of another user(in this case Guest)

schedinfo.setRightNow(true);

schedinfo.setType(CeScheduleType.ONCE);

iStore.schedule(oInfoObjects);

out.println("Emp report has been scheduled on behalf of Guest");

 

 

}

catch(SDKException e )

{

 

out.println(e.getMessage());

}

 

 

%>


Viewing all articles
Browse latest Browse all 9656

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>