on 09-16-2009 4:40 PM
Hi All,
I'm trying to access and read variables in Webi reports programmatically.
Having used .NET in the past and having no experience of Java I have opted for the .NET route.
I have got as far as connecting to a Webi document using BusinessObjects.ReportEngine. I can then list and access the DataProviders which is different queries but can not find how to access the variables.
I'm using XI3.1 and the latest V12 SDK files.
Can anyone help or point me in the right direction please?
Cheers,
John
Hello, John;
The documentation for the Report Engine is on line. Look for the [Developer Guide|http://help.sap.com/businessobject/product_guides/boexir31/en/resdk_net_dg_12_en.chm] and the [API Reference|http://help.sap.com/businessobject/product_guides/boexir31/en/resdk_net_apiRef_12_en.chm].
The code you need can be found in Note 1364779 on our Support portal:
Dim cms_name As String = System.Environment.MachineName
Dim username As String = "username"
Dim password As String = "password"
Dim authType As String = "secEnterprise"
Dim boSessionMgr As New SessionMgr
Dim boEnterpriseSession As CrystalDecisions.Enterprise.EnterpriseSession
boEnterpriseSession = boSessionMgr.Logon(username, password, cms_name, authType)
Dim boInfoStore As CrystalDecisions.Enterprise.InfoStore
boInfoStore = New CrystalDecisions.Enterprise.InfoStore(boEnterpriseSession.GetService("InfoStore"))
Dim boInfoObjects As InfoObjects
Dim qry As String = "Select SI_ID from CI_INFOOBJECTS Where SI_KIND = 'Webi' and SI_NAME ='WebI Prompt Sample'"
boInfoObjects = boInfoStore.Query(qry)
Dim boInfoObject As InfoObject
boInfoObject = boInfoObjects(1)
Dim token As String = boEnterpriseSession.LogonTokenMgr.CreateLogonTokenEx("", 30, 30)
Dim boReportEngines As New ReportEngines(token)
Dim boReportEngine As IReportEngine
boReportEngine = boReportEngines.getService(ReportEngineType.WI_ReportEngine)
Dim boDocumentInstance As IDocumentInstance
Dim docID As Integer = boInfoObject.ID
boDocumentInstance = boReportEngine.OpenDocument(docID)
boDocumentInstance.Refresh()
Dim boPrompts As IPrompts
boPrompts = boDocumentInstance.GetPrompts
Dim newVals(1) As String
newVals(0) = "2002"
newVals(1) = "2003"
Dim boPrompt As IPrompt
boPrompt = boPrompts.Item(0)
boPrompt.EnterValues(newVals)
boDocumentInstance.SetPrompts()
Dim boReport As BusinessObjects.ReportEngine.IReport
boReport = boDocumentInstance.Reports(0)
Dim boHtmlView As IHtmlView
boHtmlView = boReport.GetView(OutputFormatType.Html)
Dim myStringBuilder As New System.Text.StringBuilder
Dim myStringWriter As New System.IO.StringWriter(myStringBuilder)
Dim myTextWriter As New System.Web.UI.HtmlTextWriter(myStringWriter)
boHtmlView.WriteContent(myTextWriter)
Response.Write(myStringBuilder.ToString)
Response.End()
Elaine
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
My Code Is
IDocumentInstance webiDoc = webiReportEngine.OpenDocument(report.ID);
IPrompts prompts = webiDoc.GetPrompts();
foreach(IPrompt prompt in prompts)
{
// set prompt values here if report have prompts
...
}
webiDoc.SetPrompts();
Using ASP.NET C#
Now i want to view this document using openDocument.aspx? like
string webiURL = "http://" machineName "/OpenDocument/opendoc/opendocument.aspx?iDocID=" + webiID + "&sType=wid&sWindow=Same&token=" + token + "
.
The issue is how to pass parameters value if reports have prompts ...
User | Count |
---|---|
83 | |
24 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.