Execution des commandes externes via une macro excel
Bonjour,
j'essaie de transporter un OT (G50K900004 dans mon exemple)d'un serveur vers un autre (du serveur Qual vers le serveur Prod par exemple) en faisant un macro excel. En fait, j'ai pas trouvé de bon documents dessus :(. Donc, j'ai un bout de code qui ne marche pas (mon result est toujours égal à faux).
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
Set ctrl = CreateObject("SAP.Functions")
Set sapConnection = ctrl.Connection
sapConnection.client = "100"
sapConnection.user = "toto"
sapConnection.password = "pass"
If sapConnection.Logon(1, False) <> False Then
boolLogon = True
Set SxpgCommandExecute = ctrl.Add("SXPG_COMMAND_EXECUTE")
SxpgCommandExecute.Exports("COMMANDNAME") = "stms"
SxpgCommandExecute.Exports("TARGETSYSTEM") = "G50"
SxpgCommandExecute.Exports("STDOUT") = "X"
SxpgCommandExecute.Exports("STDERR") = "X"
SxpgCommandExecute.Exports("ADDITIONAL_PARAMETERS") = "G50K900004 G50 100"
result = SxpgCommandExecute.Call
Else
MsgBox "No connection to R/3 !"
Exit
End if |
Merci d'avance