Show TOC

SilentConnectQueryLocate this document in the navigation structure

Applies to: SAP BW (INA Provider) connections.

This API enables you to connect to a query and to set the query variables, if any. Unlike the API ConnectQuery, you must specify all the variables and variable values for the query, using the Variables and Variable values parameters.

Parameter Description
ConnectionString As String

Connection. Mandatory.

For details about the syntax you must use, see ConnectionString Parameter - Syntax

Login As String

Login to the connection. Optional

Password As String

Password to the connection. Optional

Variables As String

Specify in a table the variables to be set for the query. Note that the table must contain at least one value

Variable values As String

Specify in a table the values corresponding to the variables specified. Note that the table must contain at least one value.

Tip if you want that a report be created from the query specified, do one of the following:
Example with variables:

Sub test()

Dim cofCom As Object
Dim api As Object
Dim connectionString As String
Dim variableKeys(3) As String
Dim variableValues(3) As String

Set cofCom = Application.COMAddIns("SapExcelAddIn").Object
Set api = cofCom.GetPlugin("com.sap.epm.FPMXLClient")

variableKeys(0) = "variable1"
variableKeys(1) = "variable2"
variableKeys(2) = "variable3"
variableValues(0) = "ValueForVariable1"
variableValues(1) = "ValueForVariable2"
variableValues(2) = "ValueForVariable3"

connectionString = "SAP BW ConnectionStringWithVariable"
api.SilentConnectQuery connectionString, "user", "password", variableKeys, variableValues

End Sub
Example without variables:

Sub test()

Dim cofCom As Object
Dim api As Object
Dim connectionString As String
Dim variableKeys(0) As String
Dim variableValues(0) As String

Set cofCom = Application.COMAddIns("SapExcelAddIn").Object
Set api = cofCom.GetPlugin("com.sap.epm.FPMXLClient")

connectionString = "SAP BW ConnectionStringWithoutVariable"
api.SilentConnectQuery connectionString, "user", "pass", variableKeys, variableValues

End Sub