I am trying to call a SAP transaction from Excel, I use many codes from the internet but still a failure. Doesn't matter what code I use, I always get same error message as
A script is opening a connection to system SYSTEM
than error saying:
Runtime error 1000 Error description not avialable"
Than after debug it highlights below in yellow
Set Connection = SapGuiApp.OpenConnection("SYSTEM", True)
its been doing this with all code I tried to pull this.
Code
Dim sap As Object
Dim conn As Object
Sub T_login()
Set sap = CreateObject("SAP.Functions")
Set conn = sap.Connection
conn.System = "SYSTEM"
conn.client = "603"
conn.user = "LANAX001"
conn.Password = "alamzeb4"
conn.Language = "EN"
If conn.logon(0, False) Then
MsgBox "Logon to the SAP system is not possible", vbOKOnly, "Comment"
Else
End If
If Not IsObject(SapGuiApp) Then
Set SapGuiApp = CreateObject("Sapgui.ScriptingCtrl.1")
End If
If Not IsObject(Connection) Then
Set Connection = SapGuiApp.OpenConnection("SYSTEM", True)
End If
If Not IsObject(session) Then
Set session = Connection.Children(0)
'launch a transaction
session.findById("wnd[0]").Maximize
session.findById("wnd[0]/tbar[0]/okcd").Text = "FS10N"
session.findById("wnd[0]").sendVKey 0
End Sub
conn.System = "SYSTEM"
value: as far as I know, it should be 3-symbol identifier likeNSP
orA4H
-- see connection properties in SAP Logon. – Nikolai Kim