Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1538 connectés 

  FORUM HardWare.fr
  Programmation
  VB/VBA/VBS

  SAP connection

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

SAP connection

n°2302543
daniel-12
Posté le 27-06-2017 à 17:55:09  profilanswer
 

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 :
  1. REM Directives
  2.     Option Explicit
  3.   REM Variables!  Must declare before using because of Option Explicit
  4.     Dim WSHShell, SAPGUIPath, SID, InstanceNo, WinTitle, SapGuiAuto, application, connection, session
  5.   REM Main
  6.     Set WSHShell = WScript.CreateObject("WScript.Shell" )
  7.     If IsObject(WSHShell) Then
  8.       REM Set the path to the SAP GUI directory
  9.         SAPGUIPath = "C:Program Files (x86)SAPFrontEndSAPgui"
  10.       REM Set the SAP system ID
  11.         SID = "PAC"
  12.         'SID = "PAC"
  13.       REM Set the instance number of the SAP system
  14.         InstanceNo = "00"
  15.       REM Starts the SAP GUI
  16.         WSHShell.Exec SAPGUIPath & "SAPgui.exe " & SID & " " & _
  17.           InstanceNo
  18.       REM Set the title of the SAP GUI window here
  19.         WinTitle = "PAC"
  20.       While Not WSHShell.AppActivate(WinTitle)
  21.         WScript.Sleep 250
  22.       Wend
  23.       Set WSHShell = Nothing
  24.     End If
  25.     REM Remove this if you need to test the above script and want a message box at the end launching the login screen.
  26.     REM MsgBox "Here now your script..."
  27. If Not IsObject(application) Then
  28.    Set SapGuiAuto  = GetObject("SAPGUI" )
  29.    Set application = SapGuiAuto.GetScriptingEngine
  30. End If
  31. If Not IsObject(connection) Then
  32.    Set connection = application.Children(0)
  33. End If
  34. If Not IsObject(session) Then
  35.    Set session    = connection.Children(0)
  36. End If
  37. If IsObject(WScript) Then
  38.    WScript.ConnectObject session,     "on"
  39.    WScript.ConnectObject application, "on"
  40. End If
  41. session.findById("wnd[0]" ).maximize
  42. session.findById("wnd[0]/usr/txtRSYST-BNAME" ).text = "user"
  43. session.findById("wnd[0]/usr/pwdRSYST-BCODE" ).text = "pwd"
  44. session.findById("wnd[0]/usr/pwdRSYST-BCODE" ).setFocus
  45. session.findById("wnd[0]/usr/pwdRSYST-BCODE" ).caretPosition = 10
  46. 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

mood
Publicité
Posté le 27-06-2017 à 17:55:09  profilanswer
 

n°2302632
daniel-12
Posté le 28-06-2017 à 20:59:10  profilanswer
 

tout script VBS ou VBA permettant de me connecter a SAP, je prends aussi  :)


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  VB/VBA/VBS

  SAP connection

 

Sujets relatifs
ACCES Base de Données SAP-ASE 16.0 SP 2 via InternetWifi connection et trames échangées
Problème de connection Jpgraph avec MySQLExecuteReader : la propriété Connection n'a pas été initialisée.
Réaliser un menu de connectionConnection à un serveur
connection à une base Oracle sous java avec JDBCConnection wifi avec un .bat
Problème Connection MySQL sur mon VPS[C][reseau] connection tcp (3 voies) raw socket
Plus de sujets relatifs à : SAP connection


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR