<?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: UNIX command and SXPG_COMMAND_EXECUTE in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/unix-command-and-sxpg-command-execute/m-p/1081139#M97855</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi h k,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. I suppose a new command has already been created&lt;/P&gt;&lt;P&gt;   thru SM69.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   The Unix Command is MV (with additional required parameters )&lt;/P&gt;&lt;P&gt;   So in SM69&lt;/P&gt;&lt;P&gt;   a) Just Write mv ( in the field for os command)&lt;/P&gt;&lt;P&gt;   b) Leave blank the field of parameters for os command&lt;/P&gt;&lt;P&gt;   c) Tick the checkbox for 'Additional parameters allowed'&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Now the question for passing additional parameters :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  a) u must be having 2 variables / parameters&lt;/P&gt;&lt;P&gt;     one for source dir, and other for target dir.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  b) concatenate them in one another variable&lt;/P&gt;&lt;P&gt;    eg. concatenate srcdir trgdir TD into myvar.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Now when calling the FM,&lt;/P&gt;&lt;P&gt;   there is one optional parameter&lt;/P&gt;&lt;P&gt;   ADDITIONAL_PARAMETERS &lt;/P&gt;&lt;P&gt;   Pass the new variable MYVAR into this parameter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HOPE This Helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Amit Mittal.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 18 Nov 2005 04:52:15 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-11-18T04:52:15Z</dc:date>
    <item>
      <title>UNIX command and SXPG_COMMAND_EXECUTE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unix-command-and-sxpg-command-execute/m-p/1081137#M97853</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;Let me explain my requirement:&lt;/P&gt;&lt;P&gt;I need to move all files from source dir to target.&lt;/P&gt;&lt;P&gt;For that i need to read source dir and target dir from selection screen.&lt;/P&gt;&lt;P&gt;I wrote UNIX command as follows:&lt;/P&gt;&lt;P&gt;"mv -f /common/home/edw/parsekb/b2/* /common/home/edw/parsekb/b1"&lt;/P&gt;&lt;P&gt;where i m specifying the src and target dir.&lt;/P&gt;&lt;P&gt;so i need to pass the parmeters as srcdir and targetdir?&lt;/P&gt;&lt;P&gt;how should i do it?&lt;/P&gt;&lt;P&gt;i knw i need to create a command in SM69,then what will be the parameters in that case?&lt;/P&gt;&lt;P&gt;and how to call that from ABAP ?&lt;/P&gt;&lt;P&gt;if anybody give me explaination w.r.t. coding steps then that will be gr8.&lt;/P&gt;&lt;P&gt;but pls specify SM69 steps and ABAP both&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanx in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Nov 2005 04:33:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unix-command-and-sxpg-command-execute/m-p/1081137#M97853</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-18T04:33:59Z</dc:date>
    </item>
    <item>
      <title>Re: UNIX command and SXPG_COMMAND_EXECUTE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unix-command-and-sxpg-command-execute/m-p/1081138#M97854</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use ARCHIVFILE_SERVER_TO_SERVER function module instead of writing your own code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sanjay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Nov 2005 04:42:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unix-command-and-sxpg-command-execute/m-p/1081138#M97854</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-18T04:42:59Z</dc:date>
    </item>
    <item>
      <title>Re: UNIX command and SXPG_COMMAND_EXECUTE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unix-command-and-sxpg-command-execute/m-p/1081139#M97855</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi h k,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. I suppose a new command has already been created&lt;/P&gt;&lt;P&gt;   thru SM69.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   The Unix Command is MV (with additional required parameters )&lt;/P&gt;&lt;P&gt;   So in SM69&lt;/P&gt;&lt;P&gt;   a) Just Write mv ( in the field for os command)&lt;/P&gt;&lt;P&gt;   b) Leave blank the field of parameters for os command&lt;/P&gt;&lt;P&gt;   c) Tick the checkbox for 'Additional parameters allowed'&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Now the question for passing additional parameters :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  a) u must be having 2 variables / parameters&lt;/P&gt;&lt;P&gt;     one for source dir, and other for target dir.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  b) concatenate them in one another variable&lt;/P&gt;&lt;P&gt;    eg. concatenate srcdir trgdir TD into myvar.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Now when calling the FM,&lt;/P&gt;&lt;P&gt;   there is one optional parameter&lt;/P&gt;&lt;P&gt;   ADDITIONAL_PARAMETERS &lt;/P&gt;&lt;P&gt;   Pass the new variable MYVAR into this parameter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HOPE This Helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Amit Mittal.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Nov 2005 04:52:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unix-command-and-sxpg-command-execute/m-p/1081139#M97855</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-18T04:52:15Z</dc:date>
    </item>
    <item>
      <title>Re: UNIX command and SXPG_COMMAND_EXECUTE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unix-command-and-sxpg-command-execute/m-p/1081140#M97856</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;1. Create your shell script your_shell_script.sh:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;src=$1&lt;/P&gt;&lt;P&gt;dst=$2&lt;/P&gt;&lt;P&gt;mv -f $src $dst&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Create your command Z_YOUR_COMMAND using SM69:&lt;/P&gt;&lt;P&gt; - Operating system command: /bin/sh (the path to your shell interpretator) &lt;/P&gt;&lt;P&gt; - Parameters for operating system command: &lt;/P&gt;&lt;P&gt;/home/sap/bin/your_shell_script.sh (the path to your shell script)&lt;/P&gt;&lt;P&gt; - Set "Additional parameters allowed" checkbox&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Call your command from ABAP:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:&lt;/P&gt;&lt;P&gt;param type sxpgcolist-parameters.&lt;/P&gt;&lt;P&gt;status type extcmdexex-status,&lt;/P&gt;&lt;P&gt;exitcode type extcmdexex-exitcode,&lt;/P&gt;&lt;P&gt;it_log type table of btcxpm.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;p_src = '/common/home/edw/parsekb/b2/*'.&lt;/P&gt;&lt;P&gt;p_dst = '/common/home/edw/parsekb/b1'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;concatenate p_src p_dst into param separated by space.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'SXPG_CALL_SYSTEM'&lt;/P&gt;&lt;P&gt;       EXPORTING&lt;/P&gt;&lt;P&gt;            COMMANDNAME                = 'Z_YOUR_COMMAND'&lt;/P&gt;&lt;P&gt;            ADDITIONAL_PARAMETERS      = param&lt;/P&gt;&lt;P&gt;       IMPORTING&lt;/P&gt;&lt;P&gt;            STATUS                     = status&lt;/P&gt;&lt;P&gt;            EXITCODE                   = exitcode&lt;/P&gt;&lt;P&gt;       TABLES&lt;/P&gt;&lt;P&gt;            EXEC_PROTOCOL              = it_log&lt;/P&gt;&lt;P&gt;       EXCEPTIONS&lt;/P&gt;&lt;P&gt;            NO_PERMISSION              = 1&lt;/P&gt;&lt;P&gt;            COMMAND_NOT_FOUND          = 2&lt;/P&gt;&lt;P&gt;            PARAMETERS_TOO_LONG        = 3&lt;/P&gt;&lt;P&gt;            SECURITY_RISK              = 4&lt;/P&gt;&lt;P&gt;            WRONG_CHECK_CALL_INTERFACE = 5&lt;/P&gt;&lt;P&gt;            PROGRAM_START_ERROR        = 6&lt;/P&gt;&lt;P&gt;            PROGRAM_TERMINATION_ERROR  = 7&lt;/P&gt;&lt;P&gt;            X_ERROR                    = 8&lt;/P&gt;&lt;P&gt;            PARAMETER_EXPECTED         = 9&lt;/P&gt;&lt;P&gt;            TOO_MANY_PARAMETERS        = 10&lt;/P&gt;&lt;P&gt;            ILLEGAL_COMMAND            = 11&lt;/P&gt;&lt;P&gt;            OTHERS                     = 99.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;*TODO: add your error handling logic&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Maxim.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Nov 2005 05:00:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unix-command-and-sxpg-command-execute/m-p/1081140#M97856</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-18T05:00:23Z</dc:date>
    </item>
    <item>
      <title>Re: UNIX command and SXPG_COMMAND_EXECUTE</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/unix-command-and-sxpg-command-execute/m-p/1081141#M97857</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Why are u worrying for this u try this &lt;/P&gt;&lt;P&gt;Program it will solve ur problem.&lt;/P&gt;&lt;P&gt;u have to pass the Unix command as paramter.&lt;/P&gt;&lt;P&gt;in selection screen give this and try &lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;mv -f /common/home/edw/parsekb/b2/* /common/home/edw/parsekb/b1&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT ZTEST line-size 400&lt;/P&gt;&lt;P&gt;                no standard page heading.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;selection-screen begin of block ucmd with frame title text-001.&lt;/P&gt;&lt;P&gt;parameters: unixcom like   rlgrap-filename.   " ...SAP Interface file&lt;/P&gt;&lt;P&gt;selection-screen end of block ucmd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of tabl occurs 500,&lt;/P&gt;&lt;P&gt;        line(400),&lt;/P&gt;&lt;P&gt;      end of tabl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: lines type i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;  refresh tabl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  call 'SYSTEM' id 'COMMAND' field unixcom&lt;/P&gt;&lt;P&gt;                id 'TAB'     field tabl[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  describe table tabl lines lines.&lt;/P&gt;&lt;P&gt;  loop at tabl.&lt;/P&gt;&lt;P&gt;    write:/01 tabl-line.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;  skip 2.&lt;/P&gt;&lt;P&gt;  if lines = 0.&lt;/P&gt;&lt;P&gt;    write:/ 'NO Occurances were found'.&lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;    write:/ 'Command was successfully executed' color col_total.&lt;/P&gt;&lt;P&gt;    write:/ 'Number of entries in Search' color col_total,&lt;/P&gt;&lt;P&gt;             lines color 6.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Nov 2005 08:09:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/unix-command-and-sxpg-command-execute/m-p/1081141#M97857</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-18T08:09:11Z</dc:date>
    </item>
  </channel>
</rss>

