08-21-2008 12:28 PM
08-21-2008 12:57 PM
Hi Olian.
I would like to suggest my opinion,
Yes, I think it is possible.
It is possible through a function module,
SXPG_CALL_SYSTEM - Run an External Command.
Suggested Reference for know about passing the parameters to the function module as well as its details,
[SAP HELP Library - Standard Reference for SXPG_CALL_SYSTEM: Run an External Command (Express Method)|http://help.sap.com/saphelp_nw04/helpdata/en/fa/0971ee543b11d1898e0000e8322d00/content.htm]
SXPG_COMMAND_CHECK - Check whether the user is authorized to execute the specified command on the target host system with the specified arguments.
SXPG_COMMAND_EXECUTE - Check a useru2019s authorization to use a command, as in SXPG_COMMAND_CHECK. If the authorization check is successful, then execute the command on the target host system.
Suggested Reference,
[SAP HELP Library - Standard Reference - Programming Techniques|http://help.sap.com/saphelp_nw04/helpdata/en/fa/0971ee543b11d1898e0000e8322d00/frameset.htm]
Hope this works out well.
Good Luck & Regards.
Harsh Dave
Edited by: Harsh Dave on Aug 21, 2008 5:28 PM
08-21-2008 12:31 PM
hi,
Please check the link.
http://www.saptechies.com/execute-os-command-on-the-server/
Regards
Sumit Agarwal
08-21-2008 12:35 PM
Yes, it is possible to run an OS command.
First of all create the external command in SM69 transaction and use function module SXPG_COMMAND_EXECUTE to execute the command programmatically.
Regards,
Kiran Bobbala
08-21-2008 12:37 PM
Create External Command in SM69 .
you can call them using the SAP delivered FM SXPG_COMMAND_EXECUTE
08-21-2008 12:40 PM
Predefined command
- SM69 - Describe command (if not already) [Maintaining External Commands|http://help.sap.com/erp2005_ehp_03/helpdata/EN/c4/3a607b505211d189550000e829fbbd/frameset.htm]
- SM49 - Execute them [Executing External Command|http://help.sap.com/erp2005_ehp_03/helpdata/EN/c4/3a606e505211d189550000e829fbbd/frameset.htm] or Execute in program thru FM [SXPG_COMMAND_EXECUTE|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=sxpg_command_execute&adv=false&sortby=cm_rnd_rankvalue]
Dynamic command
- SM49 or use FM [SXPG_CALL_SYSTEM|https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=sxpg_call_system&adv=false&sortby=cm_rnd_rankvalue]
Regards
08-21-2008 12:45 PM
if your OS is unix you can do this also ...
input your unix command
REPORT ZUNIX line-size 400
no standard page heading.
parameters : unixcom like rlgrap-filename.
data: begin of tabl occurs 500,
line(400),
end of tabl.
data: lines type i.
*----------------------------------------------------------------------
start-of-selection.
refresh tabl.
call 'SYSTEM' id 'COMMAND' field unixcom
id 'TAB' field tabl[].
"if the files are different then you will some content in tabl
"Loop the tabl and write the results.
08-21-2008 12:57 PM
Hi Olian.
I would like to suggest my opinion,
Yes, I think it is possible.
It is possible through a function module,
SXPG_CALL_SYSTEM - Run an External Command.
Suggested Reference for know about passing the parameters to the function module as well as its details,
[SAP HELP Library - Standard Reference for SXPG_CALL_SYSTEM: Run an External Command (Express Method)|http://help.sap.com/saphelp_nw04/helpdata/en/fa/0971ee543b11d1898e0000e8322d00/content.htm]
SXPG_COMMAND_CHECK - Check whether the user is authorized to execute the specified command on the target host system with the specified arguments.
SXPG_COMMAND_EXECUTE - Check a useru2019s authorization to use a command, as in SXPG_COMMAND_CHECK. If the authorization check is successful, then execute the command on the target host system.
Suggested Reference,
[SAP HELP Library - Standard Reference - Programming Techniques|http://help.sap.com/saphelp_nw04/helpdata/en/fa/0971ee543b11d1898e0000e8322d00/frameset.htm]
Hope this works out well.
Good Luck & Regards.
Harsh Dave
Edited by: Harsh Dave on Aug 21, 2008 5:28 PM