cancel
Showing results for 
Search instead for 
Did you mean: 

VBScripting and SAPlogon/SAPGui

Former Member
0 Kudos

I'm trying to write a few scripts to automate a few tasks for Basis admins, but I'm new to VBScript and SAP and am having some trouble getting my scripts to launch the SAP GUI. I have scripting enabled in the client and on the server. The souce of this code is from the forums, and may people seem to be able to make it work.

Here is what I have, and when I run it (With SAP Logon running in the background) it bombs out on line 3:


1  Set SapGui = GetObject("SAPGUI")
2  Set application = SapGui.GetScriptingEngine
3  Set connection = application.OpenConnection("MY_SID", True)
4  Set Session = connection.children(0)
5  session.findById("wnd[0]/usr/txtRSYST-BNAME").text = UNAME
6  session.findById("wnd[0]/usr/pwdRSYST-BCODE").text = PWORD
7  session.findById("wnd[0]").sendVKey 0

And the error is:

Windows Script Host

Line: 3

Char: 1

Error: Error descripiton not available

Code: 800A03E8

Source: saplogon

Any help is greatly appreciated!

Accepted Solutions (1)

Accepted Solutions (1)

former_member204677
Active Participant
0 Kudos

Hi Joe,

that's strange, as the syntax seems to be fine.

Only reason I could imagine is, that the "MY_SID" does not exist in SAPLogon...

Hope that helps,

Martin

Former Member
0 Kudos

Thanks for the help, but the "MY_SID" is changed to the SID of the system I'm running it for. I just tried to run the script on another machiene and it failed at the same point with the same error.

Any help is greatly appreciated!

Answers (1)

Answers (1)

Former Member
0 Kudos

I have solved this problem. What was happening is that I was entering an SID in the application.OpenConnection() method. It has to have the exact Description String as set in the SAP Logon gui.

Since this produces no readable error, I have sent a message reporting a bug.

Thank you to all who helped out, I apprecate your efforts.

Former Member
0 Kudos

This message was moderated.