Automatic Logon in SAP BExAnalyzer by VBAProject

4

(UPDATED)

In Excel I have an add-in that gives access to the BI system to access / layer data in a specified / structured query. In my VBAProject I'm referencing the Add-in to call some specific functions of this Add-in in an Auto_Open, that is, to initialize already when opening the worksheet.

In the searches I did, the next thing I came up with was the following script:

Sub LogonToBEx2()
Application.AutomationSecurity = msoAutomationSecurityLow

logonToBW3
End Sub
Function logonToBW3() As Boolean

logonToBW3 = False

On Error Resume Next

Dim myConnection As Object
Set myConnection = Run("BExAnalyzer.XLA!SAPBEXgetConnection")

With myConnection
 .client = "800"
 .user = "usuario"
 .Password = "senha"
 .Language = PT
 .systemnumber = 1
 .system = "B1P"
 .systemid = ""
 .ApplicationServer = "B1PGroup"
 .SAProuter = ""
 .LogOn 0, True
 If .IsConnected <> 1 Then
 .LogOn 0, False
 If .IsConnected <> 1 Then
 MsgBox "something went wrong with LogOn"
 Exit Function
 End If
 End If
End With
End Function

The login window prompts the user to:

  

Mandate: User: Password: Language:

The window already comes with the data that I called in the script, but the login does not run automatically, and even though OK, the following error is displayed:

  

SAP_CMINIT #: rc = 20 > Connect to SAP gatway failed

In addition to the above error, calling the LogOn function is not enough. I need to, in some way, structure the script to feed the variant information and keep OK.

    
asked by anonymous 15.05.2017 / 15:50

1 answer

0

Good afternoon. From what I understand from the function call you can only pass the parameters referring to what you need for the login. Ex.:

dim myUser as String

myUser = "Usuário"

Call LogOn(iUser:= myUser)

Does it make sense to you?

    
20.05.2017 / 21:00