(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.