cancel
Showing results for 
Search instead for 
Did you mean: 

How to set system in VBS

Former Member
0 Kudos

Hi,

i have this little script by using scripting.


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]").resizeWorkingPane 113,38,false
session.findById("wnd[0]/usr/txtRSYST-BNAME").text = "BNAME"
session.findById("wnd[0]/usr/pwdRSYST-BCODE").text = "**********"
session.findById("wnd[0]/usr/pwdRSYST-BCODE").setFocus
session.findById("wnd[0]/usr/pwdRSYST-BCODE").caretPosition = 7
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/tbar[0]/okcd").text = "se38"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/ctxtRS38M-PROGRAMM").text = "ZMREPORT"
session.findById("wnd[0]/usr/ctxtRS38M-PROGRAMM").caretPosition = 8
session.findById("wnd[0]").sendVKey 8
session.findById("wnd[0]/usr/ctxtS_MTART-LOW").text = "ZTART"
session.findById("wnd[0]/usr/ctxtS_MTART-LOW").caretPosition = 4
session.findById("wnd[0]").sendVKey 8

How can i set the SAP-System wich i want to use.

thanks.

Regards, Dieter

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Change your connection portion to:

If Not IsObject(connection) Then

Set connection = application.OpenConnection("the name of your system")

End If

Former Member
0 Kudos

Hi,

that's it.

Thanks.

Regards, Dieter

Answers (0)