2010 Aug 25 11:53 AM
Hi, everyone. I'm trying to call an external program from ABAP by using SM69 and FM SXPG_COMMAND_EXECUTE
MOVE 'zlong_bat' to ld_comline. "Maintained using trans SM69
*
* Execute external command, contained in 'ld_comline'
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = ld_comline
* additional_parameters = ld_param "Params passed to script
* operatingsystem = 'UNIX'
IMPORTING
status = ld_status
TABLES
exec_protocol = ld_output
EXCEPTIONS
no_permission = 1
command_not_found = 2
parameters_too_long = 3
security_risk = 4
wrong_check_call_interface = 5
program_start_error = 6
program_termination_error = 7
x_error = 8
parameter_expected = 9
too_many_parameters = 10
illegal_command = 11
wrong_asynchronous_parameters = 12
cant_enq_tbtco_entry = 13
jobcount_generation_error = 14
OTHERS = 15.
IF sy-subrc NE 0.
ENDIF.In the sm69, I define zlong_bat with
Operating system command: cmd
Parameters for operating system command: /c remoteconn.bat
It can run well if remoteconn.bat contain some simple command of dos like dir, md, mk... But when I call a program from remoteconn.bat, the abap program hang. I also cannot test in sm69 because it hang too.
If I call direcly from sm 69 with
Operating system command: cmd
Parameters for operating system command: /c psexec.exe
localhost -u test -p 1234
or
Operating system command: C:\psexec.exe
Parameters for operating system command:
localhost -u test -p 1234
The SM69 also hang.
Are there any method to call a program from sap without hanging
of course the program is in its position on application server.
Thank you in advance.
Regards,
Long
Edited by: dragonking88 on Aug 25, 2010 12:54 PM
Hi Long Le Hoang,
I am running a shell script fromSM69 which call psexec.
shell script runs fine but SM69 execution goes on hold.
Can you please help me how to terminate SM69 execution.
Alpa
2010 Aug 25 12:20 PM
I would expect that SM69 is sending commands directly to your operating system (UNIX), and UNIX doesn't know what to do with that desktop command.
2010 Aug 25 12:34 PM
Unfortunately, my application server is using Windows Server 2003
2010 Aug 25 12:34 PM
While calling the FM 'SXPG_COMMAND_EXECUTE' pass space to the interface param TERMINATIONWAIT.
BR,
Suhas
2010 Aug 26 5:54 AM
I found the answer myself. Just a stupid mistake. The external program need to be confirm the Agreement at the first time program run.!!
2013 Jun 18 6:17 PM
Hi Long Le Hoang,
I am running a shell script fromSM69 which call psexec.
shell script runs fine but SM69 execution goes on hold.
Can you please help me how to terminate SM69 execution.
Alpa
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |