daniel-12 | Bonjour
je cherche un script en VBS me permettant de me connecter à SAP
j'ai essayé ce code, trouvé là
http://scn.sap.com/thread/3763970
mais cela ne fonctionne pas pour moi
Code :
- REM Directives
- Option Explicit
- REM Variables! Must declare before using because of Option Explicit
- Dim WSHShell, SAPGUIPath, SID, InstanceNo, WinTitle, SapGuiAuto, application, connection, session
- REM Main
- Set WSHShell = WScript.CreateObject("WScript.Shell" )
- If IsObject(WSHShell) Then
- REM Set the path to the SAP GUI directory
- SAPGUIPath = "C:Program Files (x86)SAPFrontEndSAPgui"
- REM Set the SAP system ID
- SID = "PAC"
- 'SID = "PAC"
- REM Set the instance number of the SAP system
- InstanceNo = "00"
- REM Starts the SAP GUI
- WSHShell.Exec SAPGUIPath & "SAPgui.exe " & SID & " " & _
- InstanceNo
- REM Set the title of the SAP GUI window here
- WinTitle = "PAC"
- While Not WSHShell.AppActivate(WinTitle)
- WScript.Sleep 250
- Wend
- Set WSHShell = Nothing
- End If
- REM Remove this if you need to test the above script and want a message box at the end launching the login screen.
- REM MsgBox "Here now your script..."
- 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]/usr/txtRSYST-BNAME" ).text = "user"
- session.findById("wnd[0]/usr/pwdRSYST-BCODE" ).text = "pwd"
- session.findById("wnd[0]/usr/pwdRSYST-BCODE" ).setFocus
- session.findById("wnd[0]/usr/pwdRSYST-BCODE" ).caretPosition = 10
- session.findById("wnd[0]" ).sendVKey 0
|
vous auriez une idée d'ou viens le problème ?
j'ai cette erreur : hostname PAC unknow alors que j'ai bien un SID avec PAC |