Skip to Content

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

How to view an in-memory webi document in HTML after ModifyDataProvider

In an existing Webi document's Query, I need to modify the Filter Operator and the Value of a constant. For example, I'm using the eFashion universe, created a Query and put a constant in there of "State" who's filter operator is currently set "Equal" and the value is set to "California".

I want modify that via the Web Services SDK to be a filter operator of "NotEqual" and value of "New York".

I am trying to use the ModifyDataProvider method which looks like exactly what I'd like to use - to modify the FilterOperator (i.e. from Equal to NotEqual) and the Operand value (i.e. from California to New York). This returns an updated DataProviderInformation that I tried using with the ReportEngine ws GetDocumentInformation but when it displays the HTML of the document I get a #SYNTAX displayed for the column headers and it shows only 1 row of data and each cell in the row is also #SYNTAX. The original webi document does return the values without issue and it contains multiple rows of data.

Here's my code:

            ' Retrieve the Query Service
            Dim queryServiceURL() As String
            Dim boQueryService As QueryService
            queryServiceURL = boSession.GetAssociatedServicesURL("QueryService")
            boQueryService = QueryService.GetInstance(boSession, queryServiceURL(0))
            ' Retrive the Data Providers
            Dim boDataProviders() As DataProviderInformation
            Dim boDataProvider As DataProviderInformation
            ' Retrieve the ReportEngine Service so it can be used to view the document
            Dim reportEngineURL() As String
            Dim boReportEngine As ReportEngine
            reportEngineURL = boSession.GetAssociatedServicesURL("ReportEngine")
            boReportEngine = ReportEngine.GetInstance(boSession, reportEngineURL(0))
            Dim boRetrieveData As RetrieveData
            boRetrieveData = New RetrieveData()
            boRetrieveData.RetrieveView = boRetrieveViewHTML
            Dim boDocumentInformation As DocumentInformation
            'boDocumentInformation = boReportEngine.GetDocumentInformation(boDocCUID, Nothing, Nothing, Nothing, Nothing)
            boDocumentInformation = boReportEngine.GetDocumentInformation(boDocCUID, Nothing, Nothing, Nothing, boRetrieveData)
            boDataProviders = boQueryService.GetDataProviderList(boDocumentInformation.DocumentReference, True)
            'temp support only 1 for now for testing
            boDataProvider = boDataProviders(0)
            ' Retrieve the Data Provider ID
            Dim boDataProviderID As String
            boDataProviderID = boDataProvider.UID
            ' Retrieve the Data Source ID
            Dim boDataSourceID As String = ""
            'boDataSourceID = boDataProvider.DataSourceUID
            ' Retrieve the Data Sources
            Dim boDataSources() As DataSource
            boDataSources = boQueryService.GetDataSourceList
            Dim boDataSource As DataSource
            Dim i As Integer
            For i = 0 To boDataSources.Length - 1
                If boDataSources(i).Name = boDataProvider.DataSourceUID Then
                    boDataSource = boDataSources(i)
                    boDataSourceID = boDataSources(i).UID.ToString
                    Exit For
                End If
            ' Retrieve the Query Specifiction
            Dim boQuerySpecification As QuerySpecification
            boQuerySpecification = boDataProvider.QuerySpecification
            ' Retrieve the Query Base
            Dim boQueryBase As New QueryBase
            boQueryBase = boQuerySpecification.QueryBase
            ' Retrieve the Query
            Dim boQuery As New Query
            boQuery = boQueryBase
            ' Retrieve the Query Conditions
            Dim boQueryCondition As QueryCondition
            boQueryCondition = boQuery.QueryCondition
            'Retrieve the Filter
            Dim boFilterInfo As Filter
            boFilterInfo = boQueryCondition.Item(0)
            Dim boFilteredObject As QueryObject
            boFilteredObject = boFilterInfo.FilteredObject
            ' Set Filter Operator to NotEqual - original webi is set to Equal
            boFilterInfo.FilterOperator = FilterOperator.NotEqual
            ' Retrieve the Operands
            Dim boOperands() As Operand
            boOperands = boFilterInfo.Operand
            Dim boOperand As Operand
            boOperand = boOperands(0)
            ' Set Operand Value
            Dim boValues As Values
            boValues = boOperand
            boValues.NativeFreeValue(0) = "New York"
            ' Set the Return Properties
            Dim boReturnProperties As New ReturnProperties
            boReturnProperties.IncludeDataSourceParameterValues = True
            boReturnProperties.IncludeQuerySpecification = True
            'boReturnProperties.NoData = False
            ' Modify the Data Provider
            Dim modifiedDataProvider As DataProviderInformation
            modifiedDataProvider = boQueryService.ModifyDataProvider(boDocumentInformation.DocumentReference, boDataProviderID, boDataSourceID, boQuerySpecification, boReturnProperties)
            'view report
            Dim boRetrieveViewHTML As RetrieveView
            boRetrieveViewHTML = New RetrieveCharacterView()
            Dim boViewSupportHTML As ViewSupport
            boViewSupportHTML = New ViewSupport()
            boViewSupportHTML.OutputFormat = OutputFormatType.HTML
            boViewSupportHTML.ViewMode = ViewModeType.REPORT_PAGE
            boViewSupportHTML.ViewType = ViewType.CHARACTER
            boRetrieveViewHTML.ViewSupport = boViewSupportHTML
            ' Retrieve the DocumentInformation, which contains all the information for a document.
            Dim oActions(0 To 0) As Action
            oActions(0) = New Refresh
            'boDocumentInformation = boReportEngine.GetDocumentInformation(modifiedDataProvider.DocumentReference, Nothing, Nothing, Nothing, boRetrieveData)
            boDocumentInformation = boReportEngine.GetDocumentInformation(modifiedDataProvider.DocumentReference, Nothing, oActions, Nothing, boRetrieveData)
            Dim boCharacterView As CharacterView
            boCharacterView = CType(boDocumentInformation1.View, CharacterView)

1. Am I going about viewing the modified in-memory document the right away?

2. If I am, then at the top of the code, I'm doing a:

boDocumentInformation = boReportEngine.GetDocumentInformation(boDocCUID, Nothing, Nothing, Nothing, boRetrieveData)

to retrieve the DocumentInformation (that I need in order to do a GetDataProviderList), do I need to include the boRetrieveData? I don't need the data for anything that I'm doing with the Query Specification but if I leave it as Nothing in that call, later when I do another call to the boReportEngine.GetDocumentInformation to which I'm passing the modifiedDataProvider.DocumentReference and I do include it I get an error.

3. At the bottom of the code I'm setting the oActions to Refresh and passing that in to the boRepotEngine.GetDocumentInformatoin as well. Is that needed? Do I need to do that and still pass the boRetrieveData?

4. How is it possible to now save the updated provider info back in to the webi document?

Or am I going about this all wrong? How should I be trying to view the in-memory document now that I've modified it's data provider information?

Former Member
Not what you were looking for? View more on this topic or Ask a question