I am able to schedule a webi report using C#. But can't able to pass prompt/parameter into the report. Please help
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 "";
}
Please help to pass paramater to WEBI Report.
I got response from SAP Team
In BI4.0, ReportEngine is deprecated for scheduling webi report with prompt, the replacement solution is RESTful Web Service SDK. You can check detailed description in the link: https://blogs.sap.com/2014/03/13/migration-guide-for-businessobjects-enterprise-sdk-custom-applications/
About the RESTful Web Service SDK, you can find more useful information in this link: https://archive.sap.com/documents/docs/DOC-51800