on 04-18-2007 3:45 PM
Hello,
I have a need to log onto many different systems using SAPGUI scripting. Below is the code segment I use to logon currently (the user is prompted for username and password earlier in the code). What I would like to do though is eliminate the need to prompt the user and just use SNC to log them on. Does anyone know how I can accomplish this with SAPGUI scripting?
Thanks!
Set SapGuiAuto = GetObject("SAPGUI")
Set application = SapGuiAuto.GetScriptingEngine
connectionString = "/H/srnp/S/3299/H/" & System & "-" & Instance & "/S/32" & Instance
Set connection = application.OpenConnectionbyConnectionString(connectionString)
Set session = connection.Children(0)
If IsObject(WScript) Then
WScript.ConnectObject session, "on"
WScript.ConnectObject application, "on"
End If
'*** Login***
session.findById("wnd[0]").resizeWorkingPane 103,24,False
session.findById("wnd[0]/usr/txtRSYST-MANDT").Text = clientNumber
session.findById("wnd[0]/usr/txtRSYST-BNAME").text = userstring
session.findById("wnd[0]/usr/pwdRSYST-BCODE").text = passwordstring
session.findById("wnd[0]/usr/pwdRSYST-BCODE").setFocus
session.findById("wnd[0]/usr/pwdRSYST-BCODE").caretPosition = 7
session.findById("wnd[0]").sendVKey 0
Hello,
from the command line this can be done with
sapgui SNC_PARTNERNAME=<snc-name> SNC_QOP=<nr> <connection>
I am not sure if it works to directly add the snc parameters into the connectionString of your script or if you need an additinal API for that.
The alternative is to define a connection in SAP logon including usage of SNC and then using the openConnection call taking the parameter as the description name in SAP logon.
For more information please refer to the <a href="https://service.sap.com/~sapidb/011000358700002236192002E">Programming API</a>.
Best regards
Rolf-Martin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.