<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Executing Unix Commands.. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/executing-unix-commands/m-p/1554072#M251132</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;I found an example program in the web, see it. it is just the FM which you mentioned, mey be useful for you&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: COMMAND3(60)
*    VALUE 'rm /vmedata/???/rlbesnsl' .
      VALUE 'rm /vmedata/???/file1nsl' .

COMMAND3+12(3) = SY-SYSID.


*submit the unix command remove file1
REMOVE_FILE = COMMAND3+3.
* create y_remove command in sm69
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
     EXPORTING
          COMMANDNAME                   = 'Y_REMOVE'
*         OPERATINGSYSTEM               = SY-OPSYS
*         TARGETSYSTEM                  = SY-HOST
*         STDOUT                        = 'X'
*         STDERR                        = 'X'
*         TERMINATIONWAIT               = 'X'
*         TRACE                         = ' '
         ADDITIONAL_PARAMETERS         = REMOVE_FILE
*    IMPORTING
*         STATUS                        =
     TABLES
          EXEC_PROTOCOL                 = PROTOCOL
     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 = 0.
  MESSAGE I114 WITH FILE1 'deleted'.
ENDIF.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;mark all the helpful answers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Sudheer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 12 Sep 2006 17:09:36 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-09-12T17:09:36Z</dc:date>
    <item>
      <title>Executing Unix Commands..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/executing-unix-commands/m-p/1554068#M251128</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  I am working on an outbound interface in which i am creating a file on the application server using OPEN DATASET and CLOSE DATASET....&lt;/P&gt;&lt;P&gt;Now my requirement is after the file is created i have to rename the file .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess this can be  done by creating an external command in SM69 and then can be called using the FM SXPG_COMMAND_EXECUTE. I just wanted to know is there any other simple FM's or any Command's in SAP by which i can execute the unix commands.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;Swaroop&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Sep 2006 16:38:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/executing-unix-commands/m-p/1554068#M251128</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-12T16:38:09Z</dc:date>
    </item>
    <item>
      <title>Re: Executing Unix Commands..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/executing-unix-commands/m-p/1554069#M251129</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;Issuing an Unix Command from ABAP&amp;lt;/b&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;* 
* Issuing an Unix Command from ABAP 
* 
REPORT ZUNIX. 

DATA  UNIXCMD(50) TYPE C. 
DATA: BEGIN OF ITAB occurs 0, 
                LINE(200), 
             end of ITAB. 

PARAMETERS UNIXCOMM LIKE UNIXCMD 
                    DEFAULT 'ls -ls /usr/sap/trans/data' LOWER CASE. 

* Executing the system commands witin ABAP. 

call 'SYSTEM' id 'COMMAND' field  UNIXCOMM 
       id 'TAB'   field  ITAB-*SYS*. 

EDITOR-CALL FOR ITAB DISPLAY-MODE.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark all the helpful answers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Sudheer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Sep 2006 16:46:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/executing-unix-commands/m-p/1554069#M251129</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-12T16:46:26Z</dc:date>
    </item>
    <item>
      <title>Re: Executing Unix Commands..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/executing-unix-commands/m-p/1554070#M251130</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sudheer, Thanks for replying for useful information..&lt;/P&gt;&lt;P&gt;I Also wanted to know the implications(is it recommended) of using the system os command directly as specified in u r code snippet. Any ways I guess in most cases the developer will not be provided with the authorization to execute the system commands directly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;Swaroop Patri...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Sep 2006 16:54:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/executing-unix-commands/m-p/1554070#M251130</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-12T16:54:42Z</dc:date>
    </item>
    <item>
      <title>Re: Executing Unix Commands..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/executing-unix-commands/m-p/1554071#M251131</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ok, Check the Below program, you will get this program in latest versions from 4.6c...&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;RSBDCOS0&amp;lt;/b&amp;gt;--&amp;gt; Execute UNIX commands &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*******************************************************&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;look OSS Note 9391&amp;lt;/b&amp;gt; for more info&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Sudheer&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Sudheer Junnuthula&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Sep 2006 17:04:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/executing-unix-commands/m-p/1554071#M251131</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-12T17:04:34Z</dc:date>
    </item>
    <item>
      <title>Re: Executing Unix Commands..</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/executing-unix-commands/m-p/1554072#M251132</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI,&lt;/P&gt;&lt;P&gt;I found an example program in the web, see it. it is just the FM which you mentioned, mey be useful for you&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: COMMAND3(60)
*    VALUE 'rm /vmedata/???/rlbesnsl' .
      VALUE 'rm /vmedata/???/file1nsl' .

COMMAND3+12(3) = SY-SYSID.


*submit the unix command remove file1
REMOVE_FILE = COMMAND3+3.
* create y_remove command in sm69
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
     EXPORTING
          COMMANDNAME                   = 'Y_REMOVE'
*         OPERATINGSYSTEM               = SY-OPSYS
*         TARGETSYSTEM                  = SY-HOST
*         STDOUT                        = 'X'
*         STDERR                        = 'X'
*         TERMINATIONWAIT               = 'X'
*         TRACE                         = ' '
         ADDITIONAL_PARAMETERS         = REMOVE_FILE
*    IMPORTING
*         STATUS                        =
     TABLES
          EXEC_PROTOCOL                 = PROTOCOL
     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 = 0.
  MESSAGE I114 WITH FILE1 'deleted'.
ENDIF.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;mark all the helpful answers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Sudheer&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Sep 2006 17:09:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/executing-unix-commands/m-p/1554072#M251132</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-12T17:09:36Z</dc:date>
    </item>
  </channel>
</rss>

