Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

report with a prompt it doesn't refresh using .net sdk

Hi, guys.

I've wrote a .net console application and it does refreshing and saving report, so I don't need manually to refresh and save report each time during deployment.

But the application works only for reports w/o prompts, does refresh and save programatically, but for report with a prompt it doesn't work and doesn't throw error.

Could you, pls, tell me what if wrong and what I'm missing in provided code below:

using System;

using System.Collections;

using System.Threading;

using System.Configuration;

using BusinessObjects.ReportEngine;

using CrystalDecisions.Enterprise;

SessionMgr sessionMgr = new SessionMgr();

EnterpriseSession enterpriseSession;

enterpriseSession = sessionMgr.Logon(admin, psw, server,

"secEnterprise");

EnterpriseService enterpriseService = enterpriseSession.GetService("InfoStore");

InfoStore ceInfoStore = new InfoStore(enterpriseService);

string strToken = enterpriseSession.LogonTokenMgr.CreateWCAToken("", 1, -1);

// Create the report engine object

ReportEngines webiReportEngines = new ReportEngines(strToken);

IReportEngine webiReportEngine = webiReportEngines.getService(ReportEngineType.WI_ReportEngine);

//get the list of reports listOfRptIDs to refresh

......

//get the list of reports to refresh

InfoObjects reportObjects = ceInfoStore.Query("Select * From "

+ " CI_INFOOBJECTS Where SI_PROGID='CrystalEnterprise.Webi' "

+ " AND SI_OWNER = 'Administrator'"

+ " AND SI_ID IN " + listOfRptIDs);

Console.WriteLine("Phase5: start refreshing the reports ");

for (int i = 0; i < reportObjects.Count; i++)

{

InfoObject report = (InfoObject) reportObjects[i+1];

Console.WriteLine(".... processing report='" + report.ID

+ "'>" + report.Title);

// Open the webi report using the report engine

IDocumentInstance webiDoc = webiReportEngine.OpenDocument(report.ID);

webiDoc.Refresh();

webiDoc.Save();

}

webiReportEngine.Close();

replied

You have to set the prompt values for the document to complete.

Refresh() you can interpret to mean "reset this document". In a normal viewing workflow, you'd Refresh(), then SetPrompts(), then GetView().

Sincerely,

Ted Ueda

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question