如何在 C# 中使用 SAP BO 4.0 SDK 传递 parameter/prompt 和安排 webi 报告

How to pass parameter/prompt & schedule the webi report using SAP BO 4.0 SDK in C#

我可以使用 C# 安排 webi 报告。但是无法将 prompt/parameter 传递到报告中。请帮助

 public string GetReport(int _reportId)
        {
            EnterpriseSession ceSession = EntSession;

            EnterpriseService ceEnterpriseService;
            InfoStore ceInfoStore;
            CrystalDecisions.Enterprise.InfoObjects ceReportObjects;
            CrystalDecisions.Enterprise.InfoObject ceReportObject;
            Report ceReport;
            string sQuery;
            try
            {
                //grab the Enterprise session
                if (ceSession != null)
                {
                   // ceSession = (EnterpriseSession)Session["ceSession"];

                    //Create the infostore object
                    ceEnterpriseService = ceSession.GetService("", "InfoStore");
                    ceInfoStore = new InfoStore(ceEnterpriseService);

                    //Create query to grab the desired report
                    sQuery = "Select top 1 SI_ID, SI_PROCESSINFO.SI_PROMPTS,* From CI_INFOOBJECTS Where  SI_ID=" + _reportId + " AND SI_INSTANCE=0 ";
                    ceReportObjects = ceInfoStore.Query(sQuery);

                    //check for returned reports
                    if (ceReportObjects.Count > 0)
                    {
                        ceReportObject = ceReportObjects[1];

                        //ceReport = (Report)ceReportObject;

                        //Create an interface to the scheduling options for the report.
                       CrystalDecisions.Enterprise.SchedulingInfo ceSchedulingInfo;
                        ceSchedulingInfo = ceReportObject.SchedulingInfo;
                        //run the report right now
                        ceSchedulingInfo.RightNow = true;
                        //run the report once only
                        ceSchedulingInfo.Type = CeScheduleType.ceScheduleTypeOnce;

                        //When scheduling to all destinations except the printer, you must first retrieve 
                        //the appropriate destination object. Each destination InfoObject is stored in the 
                        //CMS system table (CI_SYSTEMOBJECTS) under the Destination Plugins folder

                        //Retrieve the DiskUnmanaged Plugin from CI_SYSTEMOBJECTS
                      CrystalDecisions.Enterprise.InfoObjects ceDestinationObjects;
                      CrystalDecisions.Enterprise.InfoObject ceDestinationObject;
                        ceDestinationObjects = ceInfoStore.Query("Select * from CI_SYSTEMOBJECTS Where SI_NAME = 'CrystalEnterprise.DiskUnmanaged'");
                        ceDestinationObject = ceDestinationObjects[1];
                        //ReportFormatOptions ceReportFormatOpts;
                        //ceReportFormatOpts = ceReportObject.ReportFormatOptions;


                        //Create the DestinationPlugin object
                        DestinationPlugin ceDisk = new DestinationPlugin(ceDestinationObject.PluginInterface);



                        DiskUnmanagedOptions ceDiskOpts = new DiskUnmanagedOptions(ceDisk.ScheduleOptions);

                        ceDiskOpts.DestinationFiles.Add(@"" + Utility.BO.BOReportFolder + DateTime.Now.ToString("yyyy_MM_dd") + "_" + ceReportObject.Title.ToString() + ".pdf");

                        CrystalDecisions.Enterprise.Destination ceDestination;
                        ceDestination = ceSchedulingInfo.Destination;
                        ceDestination.SetFromPlugin(ceDisk);
                        List<string> reportParameterList = new List<string>();


                        Report rpt = ceReportObject as Report;
                        if (rpt != null)
                        {
                            //for each (CrystalDecisions.Enterprise.Desktop.Internal.ISReportParameter parameter in (CrystalDecisions.Enterprise.Desktop.Internal.ISReportParameter)rpt.ReportParameters)
                            //{
                            //    reportParameterList.Add(new ReportParameter(parameter));
                            //}
                            for (int i = 0; i < rpt.ReportParameters.Count; i++)
                            {
                                rpt.ReportParameters[i].DefaultValues[0].SingleValue.Value = "";
                               // ISReportParameter isp =(ISReportParameter) rpt.ReportParameters[i];
                               // reportParameterList.Add(rpt.ReportParameters[i].ToString());
                            }
                        }




                        //ReportParameters ceParameters;
                        //ReportParameterValue ceParamValue;
                        //ReportParameters rpt = ceReportObject as ReportParameters ;

                        //if (rpt != null)
                        //{


                        //    //ceParameters = ((Report)ceReportObject).ReportParameters;
                        //    foreach (ReportParameter ceParameter in rpt.ReportParameters)
                        //    {
                        //        ceParamValue = ceParameter.CreateSingleValue();
                        //        // ceParamValue.SingleValue.Value = "Time(12,15,15)";
                        //        //ceParameter.CurrentValues.Add(ceParamValue);
                        //    }
                        //}



                        //schedule report
                        ceInfoStore.Schedule(ceReportObjects);

                        return "Report Scheduled Successfully with an Object ID of : " + ceDestinationObject.ID.ToString()
                         + "<br>Report Scheduled to the following location: " + ceDiskOpts.DestinationFiles[1].ToString();
                    }

                }
                else
                {
                    //no Enterprise session available
                    return ("No Valid Enterprise Session Found!<br>"
                    + "Please click <a href='Index.aspx'>here</a> to return to the logon page.<br>");
                }
            }
            catch (Exception err)
            {
                throw new Exception(
                "There was an error scheduling the report: <br>" +
                err.Message.ToString() + "<br>" +
                "Please click <a href='Index.aspx'>here</a> to return to the logon page.<br>");
            }
            return "";
        }

请帮助将参数传递给 WEBI 报告。

我收到了 SAP 团队的回复

在BI4.0中,ReportEngine被弃用用于调度带提示的webi报表,替代解决方案是RESTfulWeb Service SDK。 您可以在link中查看详细说明:https://blogs.sap.com/2014/03/13/migration-guide-for-businessobjects-enterprise-sdk-custom-applications/

关于 RESTful Web 服务 SDK,您可以在此 link 中找到更多有用的信息:https://archive.sap.com/documents/docs/DOC-51800