Skip to Content
author's profile photo Former Member
Former Member

VBScripting and SAPlogon/SAPGui

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!

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Jul 27, 2010 at 01:28 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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!

  • author's profile photo Former Member
    Former Member
    Posted on Jul 27, 2010 at 09:16 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.