Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Execute a command on SAP server

Former Member
0 Likes
1,106

HI I have a SAP qith Unix O.S.

Is there an abap command or function module in order to execute a unix command on SAP?

example "ls - la" in order to have a list of files

or

"ren old.file new.file"

Thanks

3 REPLIES 3
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
715

SXPG_COMMAND_EXECUTE

You have to configure the command in SM69 before using this fm

Read only

Former Member
0 Likes
715

Hi Fabrizio,

You should avoid this as possible, but if you have really to execute UNIX command, you also can use standard report RSBDCOS0.

You can also use ABAP :


CALL 'SYSTEM' ID 'COMMAND' FIELD ld_command
              ID 'TAB'     FIELD lt_result.

Best regards,

Samuel

Read only

Former Member
0 Likes
715
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
         EXPORTING
              COMMANDNAME                = COMMANDNAME
              OPERATINGSYSTEM            = OPERATINGSYSTEM
              ADDITIONAL_PARAMETERS      = ADDITIONAL_PARAMETERS
         IMPORTING
              STATUS                     = STATUS
              EXITCODE                   = EXITCODE
         TABLES
              EXEC_PROTOCOL              = EXEC_PROTOCOL

Check the link:-

http://help.sap.com/saphelp_40b/helpdata/EN/fa/0971fb543b11d1898e0000e8322d00/content.htm

Hope it helps you..

Manas M.