Skip to Content
0
Former Member
Mar 19, 2009 at 01:57 PM

Not able to schedule report to INBOX with format excel or PDF

43 Views

Hi All,

Below is the code which I am trying schedule my webi report to inbox.

Report is seen in inbox but in webi format, I need it in excel.

<%@page import="com.crystaldecisions.sdk.plugin.destination.managed.IManagedOptions"%>

<%@page import="com.crystaldecisions.sdk.plugin.destination.managed.IManaged"%>

<%@page import="com.businessobjects.sdk.plugin.desktop.webi.IWebiFormatOptions"%>

<%@page import="java.util.LinkedHashMap"%>

<%@page import="java.util.HashMap"%>

<%@page import="java.util.List"%>

<%@page import="com.businessobjects.sdk.plugin.desktop.webi.IWebiProcessingInfo"%>

<%@page import="com.businessobjects.sdk.plugin.desktop.webi.internal.IWebiPrompts"%>

<%@page import="com.businessobjects.sdk.plugin.desktop.webi.IWebiPrompt"%>

<%@page import="com.businessobjects.sdk.plugin.desktop.webi.IWebi"%>

<%@ page import="com.crystaldecisions.sdk.framework.*" %>

<%@ page import="com.crystaldecisions.sdk.occa.infostore.*" %>

<%@ page import="com.crystaldecisions.sdk.plugin.CeKind" %>

<%@ page import="com.businessobjects.rebean.wi.*" %>

<%

try

{

ISessionMgr sessionMgr = CrystalEnterprise.getSessionMgr();

IEnterpriseSession boEnterpriseSession = CrystalEnterprise.getSessionMgr().logon( "vgawande","","boserver","secEnterprise");

IInfoStore boInfoStore =(IInfoStore) boEnterpriseSession.getService("InfoStore");

String query = "SELECT * FROM CI_INFOOBJECTS WHERE SI_ID=319644";

IInfoObjects boInfoObjects = (IInfoObjects) boInfoStore.query(query);

IWebi webiDoc = (IWebi)boInfoObjects.get(0);

ISchedulingInfo scheduleInfo;

scheduleInfo = webiDoc.getSchedulingInfo();

webiDoc.getWebiFormatOptions().setFormat(IWebiFormatOptions.CeWebiFormat.EXCEL);

scheduleInfo.setRightNow(true);

scheduleInfo.setType(CeScheduleType.ONCE);

IInfoObjects managedInfoObjects = boInfoStore.query("Select SI_DEST_SCHEDULEOPTIONS, SI_PROGID From CI_SYSTEMOBJECTS Where SI_NAME = 'CrystalEnterprise.Managed'");

IInfoObject iObject = (IInfoObject)managedInfoObjects.get(0);

IDestinationPlugin destinationPlugin = (IDestinationPlugin)iObject;

IManaged managed = (IManaged)destinationPlugin;

IManagedOptions managedOptions = (IManagedOptions)managed.getScheduleOptions();

managedOptions.setDestinationOption(IManagedOptions.CeDestinationOption.ceInbox);

managedOptions.setSendOption(IManagedOptions.CeManagedSendOption.ceCopy);

managedOptions.setIncludeInstance(true);

managedOptions.setCreateNewObject(true);

managedOptions.getDestinations().add(308288);

IDestinations dests= scheduleInfo.getDestinations();

dests.add("CrystalEnterprise.Managed");

IDestination destination = (IDestination)scheduleInfo.getDestinations().get(0);

destination.setFromPlugin(destinationPlugin);

boInfoStore.sendTo(boInfoObjects);

}

catch(Exception e)

{

out.println("error occured");

}

%>

Can anyone please help me , finding mistake am doing?

Thanks,

Praveen.