Skip to Content
0
Feb 19, 2009 at 06:30 PM

Data fetch from query in Bex Analyzer through Bex API

288 Views

Iu2019m unable to fetch data form query in Bex Analyzer when invoking through Bex API. Iu2019m using visual basic application to launch excel, connect to BI server and get data from the Bex query. Iu2019m able to connect to the server, but unable to fetch data returned from the query and getting following error in a modal window.

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

u201CThe query OUTESTQUERY on infoprovider canu2019t be assigned to the dataprovider DATA_PROVIDER_1

I'm not sure why i'm not able to get query results in worksheet? Can anyone also point me to Bex 7,0 API documentation and some expample?

Following is code example.

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"
   .Logon 0, True
   If .IsConnected = 0 Then
     .Logon 0, False
      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 if
End With
app.Run (BexPath & "!SAPBEXinitConnection")

     ' FOLLOWING LINE OF CODE GIVING ERROR IN A MODAL WINDOW 
Call app.Run(BexPath & "! runQuery", "0D_SD_C03/OUTESTQUERY")