Using following code to login to SAP.
Sub Logontrial()
Dim SapGuiApp As Object
Dim oConnection As Object
Dim session As Object
Dim SAPCon As Object, SAPSesi As Object
Dim SAPGUIAuto As Object, SAPApp As Object
Dim sapConnection As Object
If SapGuiApp Is Nothing Then
Set SapGuiApp = CreateObject("Sapgui.ScriptingCtrl.1")
End If
If oConnection Is Nothing Then
Set oConnection = SapGuiApp.OpenConnection("Description of connection")
End If
If SAPSesi Is Nothing Then
Set SAPSesi = oConnection.Children(0)
End If
sapConnection.Client = "011"
sapConnection.User = "TEST123"
sapConnection.Password = "XXXX"
sapConnection.Language = "EN"
End Sub
Run Time Error '1000'. SAP logon connection entry not found.Have done ample R&D in this subject. Still no success. Corrections to this code will be appreciated.
This Question was resolved for me by @AxelRichter's comment above:
In SapGuiApp.OpenConnection("Description of connection") the Description of connection must exactly match the Name of the SAP connection as shown in Logon Pad.
NAME NAME NAME is the stuff. I had the same issue, all time long I had the SID (3 CHARACTER) going on working on my macro, then stopped working, then changed to the NAME oft he connection (DESCRIPTION OF THE CONNECTION) and it worked. Thanks to Axel Richter for his comment.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.