06-19-2013 10:58 AM
Hi all
my question is simple:
Is it possible in abap to execute a program (.bat file) stored on server? In background would be great ...
thanks
Gabriele
06-19-2013 11:24 AM
Create an external command in transaction SM69, specifying path of batch file on server.
Write an ABAP program which will run this external command defined in SM69 using function module SXPG_COMMAND_EXECUTE. You can then schedule you ABAP program to run batch file.
Regards,
Pawan.
06-19-2013 11:22 AM
BAT file would mean Windows commands.
If application server is running Windows operating system, batch file can be executed, in background.
06-19-2013 11:24 AM
Create an external command in transaction SM69, specifying path of batch file on server.
Write an ABAP program which will run this external command defined in SM69 using function module SXPG_COMMAND_EXECUTE. You can then schedule you ABAP program to run batch file.
Regards,
Pawan.
03-08-2014 7:14 AM
if the batch file is not located in application server and the client system then also can we run it?
Means lets say the batch file is located a another server other than client system and application server. Can we run it through sm69?
06-19-2013 11:26 AM
Hi Gabriele,
Follow the steps:
1) Define external operating system command say zcopytm1 using SM69 by using the following parameters:
Command name Operating system Type
ZCOPYTM1 Windows NT Customer
Operating system command
e:\tm1out\tm1ph.bat
Parameters for operating system command
Leave this blank
tm1ph.bat is the batch file which it will execute.
2) First test it using SM49. Once satisfied use the following code to execute it thru ABAP:
DATA: BEGIN OF t_copy OCCURS 1.
INCLUDE STRUCTURE btcxpm.
DATA: END OF t_copy.
DATA: statusline LIKE btcxp3-exitstat.
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = 'zcopytm1'
status = statusline
TABLES
exec_protocol = t_copy
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.
Hope it helps
03-08-2014 7:15 AM
03-18-2014 8:28 AM