cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to Launch query throgh Bex API

obaid_ullah2
Explorer
0 Kudos

Iu2019m trying to automate a Bex application form an out of process application for automated testing. I want to accomplish following four things:

1. Launch Excell.

2. Launch Bex add ins.

3. Connect to Bex server.

4. Open a query and display it results in the excel worksheet.

I was able to accomplish first 4 tasks from an application written in visual basic. However, Iu2019m not able to open any query. Iu2019m using following Bex api to open a query:

Call app.Run(BexPath & "! runQuery", "First Query")

No matter what query name I provide Iu2019m getting following errors and excel worksheet does not display any resutls:

u201CThe requested query /First QUERY does not exist on the current server.

u201CThe query FIRST QUERY on infoprovider canu2019t be assigned to the dataprovider DATA_PROVIDER_1

Iu2019m really stuck at this point and any help shall be appreciated. Iu2019m new to this ear of programming so please tell me if there is some alternate way to accomplish these tasks. When providing name of the query in above API Iu2019m not sure if technical name of the query need to be provided and if query or info cube resides in some nested structure, should I provide a full path or just query name. For example if full path of query u201CSAP Demou201D is u201CInfoAreas\SAP Demo\SAP Demo Sales and Distribution:Overview\SAP Demou201D then what kind of string format is should provide to access u201CSAP Demou201D query.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member183777
Active Contributor
0 Kudos

Try "Infocube technical Name/Query technical name" ex:

0DEMO_C01/Y_DEMO_Q001

obaid_ullah2
Explorer
0 Kudos

Providing technical name did not make any change. I had tried that option before. My code is very simple as documented below (VB).

BexPath As String = "'C:\Program Files\Common Files\SAP Shared\BW\BExAnalyzer.xla'"

Set app = CreateObject("Excel.Application")

Dim myWorkbook As Excel.workbook

app.Visible = True

Call app.Run(BexPath & "!SetStart")

' Create logon to system with following user and system details

Set myConnection = app.Run(BexPath & "! SAPBEXgetConnection")

With myConnection

.client = "800"

.User = "zzzz"

.Password = "xxxxx"

.Language = "en"

.systemnumber = "01"

.System = "R3I"

.systemid = ""

.ApplicationServer = "zzzzzz"

.SAProuter = ""

.Logon 0, True

If .IsConnected = 0 Then

.Logon 0, False

If .IsConnected <> 1 Then

MsgBox "Automatic logon failed. Please enter your username and password in the next screen ..."

Exit Function

End If

End If

End With

' Run connection query to see if connected

app.Run (BexPath & "!SAPBEXinitConnection")

' FOLLOWING LINE OF CODE GIVING ERROR IN A MODAL WINDOW

Call app.Run(BexPath & "! runQuery", "0D_SD_C03/OUTESTQUERY")