Hi Experts,
I have created a desktop shortcut to access the SAP ECC environment, similar as described on this wiki: https://wiki.scn.sap.com/wiki/display/ABAP/SAPGUI+shortcuts
Then, when I do the login through this shortcut, the script below simple does not work.
If Not IsObject(application) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(connection) Then
Set connection = application.Children(0)
End If
If Not IsObject(session) Then
Set session = connection.Children(0)
End If
If IsObject(WScript) Then
WScript.ConnectObject session, "on"
WScript.ConnectObject application, "on"
End If
session.findById("wnd[0]").maximize
session.findById("wnd[0]/tbar[0]/okcd").text = "/nMM03"
session.findById("wnd[0]").sendVKey 0
The error is:
Windows Script Host
Script: C:\temp\Script5.vbs
Line: 2
Charact.: 4
Error: Invalid Syntax
Code: 800401E4
Source: (null)
It seems that the GetObject("SAPGUI") function returns Nothing, then the Set statement does not work.
When I do the login through saplogon, it works just fine.
Has anyone experienced this before? Any ideas?
Tks
Darley