cancel
Showing results for 
Search instead for 
Did you mean: 

VBA BEX Automation - Error Code 438 in SAPBEXinitConnection

Former Member

I am using the following auto login script from SAP using Example 1.

https://wiki.scn.sap.com/wiki/display/BI/Using+VBA+to+connect+to+BW+server+with+SAPBEXgetConnection

Function LogonToServer() As Boolean
   LogonToServer = False
   Dim myConnection As Object
   Set myConnection = Run("BExAnalyzer.xla!SAPBEXgetConnection")
   With myConnection
      .client = "000"
      .user = "myUserName"
      .Password = "myPassword"
      .Language = "EN"
      .systemnumber = 45
      .system = "XXX"
      .ApplicationServer = "ab1234.wdf.sap.corp"
      .SAProuter = ""
      .logon 0, True
   End With
   If myConnection.IsConnected <> 1 Then
      'launch the Logon Dialog for manual connection
      myConnection.logon 0, False
         If myConnection.IsConnected <> 1 Then
            MsgBox "something went wrong ..."
            Exit Function
         End If
   End If
   If myConnection.IsConnected = 1 Then
      LogonToServer = True
   End If
   Run "BExAnalyzer.xla!SAPBEXinitConnection"
End Function

I get an 438 error on

Call pAddin.ExcelInterface.SetConnectionFromHandle(p_connectionObj)

line below.  Any suggestions to fix?
Public Function initConnection() As Boolean
  initConnection = False
  If isConnected Then
    With p_connectionObj
    End With
    If pAddin Is Nothing Then Call SetStart
    If pAddin Is Nothing Then
      initConnection = False
      Exit Function
    End If
    Call pAddin.ExcelInterface.SetConnectionFromHandle(p_connectionObj)
    If Len(pWbid) > 1 Then
      Call pAddin.ExcelInterface.runWorkbook(pWbid)
    Else
      If Len(pQueryid) > 1 Then
        Call pAddin.ExcelInterface.runQuery(pQueryid)
      End If
    End If
  End If
  initConnection = isConnected
End Function
Former Member
0 Kudos

I am using BI Addon ver 7.4 support package 8

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hello,

i have the same issue, did you get any solution for this,

thans
ahmed

former_member231709
Active Contributor
0 Kudos

Check note 2541995 - BEx Analyzer: Using VBA to connect to BW server with SAPBEXgetConnection

Former Member
0 Kudos

Hi,

I have the same problem... Is there a solution?

Thanks

Marina