cancel
Showing results for 
Search instead for 
Did you mean: 

4.1 Scheduling a Crystal Report with Params

DellSC
Active Contributor
0 Kudos

Ok, I've spent the last several hours searching through sample code and documentation and I can't find anything here on SCN.  The VB sample code that purports to be for 4.1 won't work because there is no more CrystalDecisions.Desktop.Report assembly or classes.  The RESTful web services SDK won't work because the Crystal-specific pieces of that only works with Crystal for Enterprise reports.   I have code for scheduling Crystal with all sorts of options for BO3.1, but I have found NOTHING that works with 4.1.

Since there is no more Report class in .NET, how is this supposed to be with 4.1? - I do NOT want to have to shell out to Java to do this!

Thanks!

-Dell

Accepted Solutions (1)

Accepted Solutions (1)

former_member188030
Active Contributor
0 Kudos

Hi Dell,

I remember doing this while writing the Migration doc and it did work for BI 4.1.

So I tried it and it worked again. Here is the WS SDK code I used to schedule a report 'RunNow' which has one static number parameter.

************

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BusinessObjects.DSWS;
using BusinessObjects.DSWS.BIPlatform;
using BusinessObjects.DSWS.BIPlatform.Constants;
using BusinessObjects.DSWS.BIPlatform.Desktop;
using BusinessObjects.DSWS.ReportEngine;
using BusinessObjects.DSWS.Session;

public partial class _Default : System.Web.UI.Page
{
    // CMS-specific parameters
    private static string CMS_USER = "Administrator";
    private static string CMS_USER_PASSWORD = "Password";
    private static string CMS_CLUSTER_NAME = string.Empty;
    private static string CMS_AUTHENTICATION = string.Empty;

    // Web Service URLs
    private static string WS_BASE_URL = "http://localhost:8080/dswsbobje/services/";
    private static string WS_URL_SESSION = WS_BASE_URL + "Session";
    private static string WS_URL_REPORTENGINE = WS_BASE_URL + "reportengine";
    private static string WS_URL_BIPLATFORM = WS_BASE_URL + "biplatform";
    private static string REPORT_NAME = "Report1";
    private static string REPORT_STRING = "Report1.rpt";

    private BIPlatform bipService;
    private ReportEngine boRepEng;
    private BusinessObjects.DSWS.Session.Session wSession;


    protected void Page_Load(object sender, EventArgs e)
    {

    }
    override protected void OnInit(EventArgs e)
    {
                ConfigureCrystalReports();
    }

    private void ConfigureCrystalReports()
    {
        Logon();
        Schedule();
    }

    private void Logon()
    {
        wSession = null;

        try
        {
            BusinessObjects.DSWS.Connection boConnection = new BusinessObjects.DSWS.Connection(WS_URL_SESSION);

            // login to BusinessObjects Enterprise using web services
            Console.WriteLine("Logging into web service...");
            EnterpriseCredential credential = new EnterpriseCredential();
            credential.Login = CMS_USER;
            credential.Password = CMS_USER_PASSWORD;
            wSession = new BusinessObjects.DSWS.Session.Session(boConnection);
            wSession.Login(credential);
            Console.WriteLine("Logged into web service.");

            // initialize platform service
            boConnection.URL = WS_URL_BIPLATFORM;
            bipService = new BIPlatform(boConnection, wSession.ConnectionState);

            // initialize report engine service
            boConnection.URL = WS_URL_REPORTENGINE;
            boRepEng = new ReportEngine(boConnection, wSession.ConnectionState);

            Session["ReportEngine"] = boRepEng;
        }
        catch (BusinessObjects.DSWS.DSWSException ex)
        {
            Console.Error.WriteLine(ex);
            Console.Error.WriteLine(ex.CauseDetail);
            throw;
        }
    }

    private void Schedule()
    {
        try
        {
            GetOptions oGetOptions = new GetOptions();
            oGetOptions.IncludeSecurity = false;
            ResponseHolder rh = bipService.Get("path://InfoObjects/Root Folder/Report Samples/NewNewFOlder/" + REPORT_STRING + "" + "@SI_SCHEDULEINFO, SI_PROCESSINFO", oGetOptions);
            InfoObjects oInfoObjects = rh.InfoObjects;

            CrystalReport oReport = (CrystalReport)oInfoObjects.InfoObject[0];

            //for webi or fullClient reports you would cast the infoobject as webi or full client report
            //oReport = (Webi)oInfoObjects.InfoObject;
            //oReport = (FullClient)oInfoObjects.InfoObject;

            oReport.Name = REPORT_NAME;
            SchedulingInfo oSchedulingInfo = new SchedulingInfo();
            oReport.SchedulingInfo = oSchedulingInfo;

            oReport.SchedulingInfo.RightNow = true;

           /* to schedule a report with discrete parameter information, use the following code snippet
            ************************************************************************************'*/
            ReportProcessingInfo procInfo = oReport.PluginProcessingInterface;
            ReportParameter[] repParams = procInfo.ReportParameters;
            CurrentValues oCurrentValues = new CurrentValues();
            BusinessObjects.DSWS.BIPlatform.Desktop.PromptValue[] oPromptValue = new BusinessObjects.DSWS.BIPlatform.Desktop.PromptValue[1];
            oPromptValue[0] = new BusinessObjects.DSWS.BIPlatform.Desktop.PromptValue();
            oPromptValue[0].Data = "144100";
            oCurrentValues.CurrentValue = oPromptValue;
            repParams[0].CurrentValues = oCurrentValues;
           // ************************************************************************************ */

            bipService.Schedule(oInfoObjects);
            Response.Write("Your report has been successfully scheduled. Log in to BusinessObjects Java InfoView and navigate to the location of your report to view your scheduled instance.");
        }
        catch (BusinessObjects.DSWS.DSWSException ex)
        {
            Console.WriteLine(ex.ToString());
            Console.WriteLine(ex.CauseDetail.ToString());
            throw;
        }
    }
}

**********************

The complete sample (Schedule_CS) is here; http://scn.sap.com/docs/DOC-6371

The sample is for Xi 3.1 but works with 4.1 references as well.

And here is the Migration Doc I was refering to. http://scn.sap.com/docs/DOC-53285

Hope this helps,

Thanks,

Bhushan.

DellSC
Active Contributor
0 Kudos

Thanks Bhushan.

Actually, I finally remembered that the Report class is still there in the regular .NET SDK - however CrystalDecisions.Enterprise.Desktop.Report.dll, which contains all of the classes for this, is NOT in the same folder as the rest of the .NET SDK and it doesn't get registered in the GAC.  All of the rest of the SDK is in both

<Install Dir>\win32_x86\dotnet\iPoint

and

<Install Dir>\win64_x64\dotnet\iPoint

But CrystalDecisions.Enterprise.Desktop.Report.dll is up one folder level in both

<Install Dir>\win32_x86\dotnet

and

<Install Dir>\win64_x64\dotnet

I can reference it directly from there to get to what I need.

-Dell

former_member188030
Active Contributor
0 Kudos

Ahhhh... and there is that...

I should have recalled it at the first place... glad you did .

Thanks for writing it out here. This will help other users too.

Thanks,

Bhushan

Answers (0)