<?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: Problem executing FTP command in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-executing-ftp-command/m-p/4955214#M1155321</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;Once you login to remote server using FTP_CONNECT it will login into default directory.&lt;/P&gt;&lt;P&gt;If you want to change the location of file to be placed from default directory, then you need to use LCD command to change the directory path(before you use put command).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*L_SRC is source directory&lt;/P&gt;&lt;P&gt;   CONCATENATE 'lcd' l_src INTO l_com SEPARATED BY space.&lt;/P&gt;&lt;P&gt;      CALL FUNCTION 'FTP_COMMAND'&lt;/P&gt;&lt;P&gt;        EXPORTING&lt;/P&gt;&lt;P&gt;          handle        = hdl&lt;/P&gt;&lt;P&gt;          command       = l_com "&lt;/P&gt;&lt;P&gt;        TABLES&lt;/P&gt;&lt;P&gt;          data          = tb_result&lt;/P&gt;&lt;P&gt;        EXCEPTIONS&lt;/P&gt;&lt;P&gt;          tcpip_error   = 1&lt;/P&gt;&lt;P&gt;          command_error = 2&lt;/P&gt;&lt;P&gt;          data_error    = 3&lt;/P&gt;&lt;P&gt;          OTHERS        = 4.                                "#EC *&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then in your put command just pass the file name, no path is required.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;your  CMD = put /interface/outbound/test.dat test.dat &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; put 'sourcerfile' 'targetfile'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please try with this ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Savitha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 23 Dec 2008 06:06:44 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-12-23T06:06:44Z</dc:date>
    <item>
      <title>Problem executing FTP command</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-executing-ftp-command/m-p/4955210#M1155317</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gurus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is a need for transferring a file from Application server to a remote server using FTP.&lt;/P&gt;&lt;P&gt;I am able to connect to the remote server and execute commands but the main problem is how do i transfer a file existing in application server as in are there any specific command sthat can be executed using FM FTP_COMMAND (e.g. lcd filepath ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please advice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many Thanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Saikiran Reddy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: SAI KIRAN REDDY ARVA on Dec 19, 2008 10:24 AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: SAI KIRAN REDDY ARVA on Dec 19, 2008 10:24 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Dec 2008 09:23:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-executing-ftp-command/m-p/4955210#M1155317</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-19T09:23:54Z</dc:date>
    </item>
    <item>
      <title>Re: Problem executing FTP command</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-executing-ftp-command/m-p/4955211#M1155318</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;You might have used ftp_connect to connect to remote server. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Establish FTP connection&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL FUNCTION 'FTP_CONNECT'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      USER            = P_USER&lt;/P&gt;&lt;P&gt;      PASSWORD        = P_PWD&lt;/P&gt;&lt;P&gt;      HOST            = P_HOST&lt;/P&gt;&lt;P&gt;      RFC_DESTINATION = P_DEST&lt;/P&gt;&lt;P&gt;    IMPORTING&lt;/P&gt;&lt;P&gt;      HANDLE          = LV_HDL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
DATA     LV_CMD(250) TYPE C .
  CLEAR LV_CMD.

  *CONCATENATE 'put' P_FNAME P_FILE INTO LV_CMD*
                         *SEPARATED BY SPACE.** Establish FTP connection
***P_FNAME --local file name
***P_FILE remote file name
  CALL FUNCTION 'FTP_COMMAND'
    EXPORTING
      HANDLE        = lv_HDL
      COMMAND       = LV_CMD
      COMPRESS      = 'N'
    TABLES
      DATA          = IT_RESULT
    EXCEPTIONS
      COMMAND_ERROR = 1
      TCPIP_ERROR   = 2.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Dec 2008 12:34:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-executing-ftp-command/m-p/4955211#M1155318</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-19T12:34:12Z</dc:date>
    </item>
    <item>
      <title>Re: Problem executing FTP command</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-executing-ftp-command/m-p/4955212#M1155319</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;DATA: BEGIN OF MTAB_DATA OCCURS 0&lt;/P&gt;&lt;P&gt;,LINE(132) TYPE C,&lt;/P&gt;&lt;P&gt;END OF MTAB_DATA.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: MC_PASSWORD(20) TYPE C,&lt;/P&gt;&lt;P&gt;      MI_KEY TYPE I VALUE 26101957,&lt;/P&gt;&lt;P&gt;      MI_PWD_LEN TYPE I,&lt;/P&gt;&lt;P&gt;      MI_HANDLE TYPE I.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;START-OF-SELECTION.&lt;/P&gt;&lt;P&gt;*-- Your SAP-UNIX FTP password (case sensitive)&lt;/P&gt;&lt;P&gt;  MC_PASSWORD = 'password'.&lt;/P&gt;&lt;P&gt;  DESCRIBE FIELD MC_PASSWORD LENGTH MI_PWD_LEN IN BYTE MODE.&lt;/P&gt;&lt;P&gt;*-- FTP_CONNECT requires an encrypted password to work&lt;/P&gt;&lt;P&gt;  CALL 'AB_RFC_X_SCRAMBLE_STRING'&lt;/P&gt;&lt;P&gt;       ID 'SOURCE' FIELD MC_PASSWORD&lt;/P&gt;&lt;P&gt;       ID 'KEY' FIELD MI_KEY&lt;/P&gt;&lt;P&gt;       ID 'SCR' FIELD 'X'&lt;/P&gt;&lt;P&gt;       ID 'DESTINATION' FIELD MC_PASSWORD&lt;/P&gt;&lt;P&gt;       ID 'DSTLEN' FIELD MI_PWD_LEN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'FTP_CONNECT'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;*-- Your SAP-UNIX FTP user name (case sensitive)&lt;/P&gt;&lt;P&gt;    USER            = 'userid'&lt;/P&gt;&lt;P&gt;    PASSWORD        = MC_PASSWORD&lt;/P&gt;&lt;P&gt;*-- Your SAP-UNIX server host name (case sensitive)&lt;/P&gt;&lt;P&gt;    HOST            = 'unix-host'&lt;/P&gt;&lt;P&gt;    RFC_DESTINATION = 'SAPFTP'&lt;/P&gt;&lt;P&gt;    IMPORTING       HANDLE          = MI_HANDLE&lt;/P&gt;&lt;P&gt;    EXCEPTIONS       NOT_CONNECTED   = 1&lt;/P&gt;&lt;P&gt;    OTHERS          = 2.&lt;/P&gt;&lt;P&gt;  CHECK SY-SUBRC = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'FTP_COMMAND'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      HANDLE        = MI_HANDLE&lt;/P&gt;&lt;P&gt;      COMMAND       = 'dir'&lt;/P&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      DATA          = MTAB_DATA&lt;/P&gt;&lt;P&gt;    EXCEPTIONS&lt;/P&gt;&lt;P&gt;      TCPIP_ERROR   = 1&lt;/P&gt;&lt;P&gt;      COMMAND_ERROR = 2&lt;/P&gt;&lt;P&gt;      DATA_ERROR    = 3&lt;/P&gt;&lt;P&gt;      OTHERS        = 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF SY-SUBRC = 0.&lt;/P&gt;&lt;P&gt;    LOOP AT MTAB_DATA.&lt;/P&gt;&lt;P&gt;      WRITE: / MTAB_DATA.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;do some error checking.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    WRITE: / 'Error in FTP Command'.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'FTP_DISCONNECT'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      HANDLE = MI_HANDLE&lt;/P&gt;&lt;P&gt;    EXCEPTIONS&lt;/P&gt;&lt;P&gt;      OTHERS = 1.&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;Aveek&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Dec 2008 14:39:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-executing-ftp-command/m-p/4955212#M1155319</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-19T14:39:17Z</dc:date>
    </item>
    <item>
      <title>Re: Problem executing FTP command</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-executing-ftp-command/m-p/4955213#M1155320</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;Using FTP_CONNECT i am able to connect to the remote server but the problem occurs while executing the command using FTP_COMMAND.&lt;/P&gt;&lt;P&gt;I have to transfer a file from application server with the following path &lt;/P&gt;&lt;P&gt;/interface/outbound/test.dat to remote server \import\test.dat&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am getting "error 22 invalid argument" &lt;/P&gt;&lt;P&gt;I am passing CMD = put /interface/outbound/test.dat \import\test.dat &lt;/P&gt;&lt;P&gt;as in put 'sourcerfile' 'targetfile'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please advice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Saikiran Reddy&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 22 Dec 2008 12:35:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-executing-ftp-command/m-p/4955213#M1155320</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-22T12:35:00Z</dc:date>
    </item>
    <item>
      <title>Re: Problem executing FTP command</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-executing-ftp-command/m-p/4955214#M1155321</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;Once you login to remote server using FTP_CONNECT it will login into default directory.&lt;/P&gt;&lt;P&gt;If you want to change the location of file to be placed from default directory, then you need to use LCD command to change the directory path(before you use put command).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*L_SRC is source directory&lt;/P&gt;&lt;P&gt;   CONCATENATE 'lcd' l_src INTO l_com SEPARATED BY space.&lt;/P&gt;&lt;P&gt;      CALL FUNCTION 'FTP_COMMAND'&lt;/P&gt;&lt;P&gt;        EXPORTING&lt;/P&gt;&lt;P&gt;          handle        = hdl&lt;/P&gt;&lt;P&gt;          command       = l_com "&lt;/P&gt;&lt;P&gt;        TABLES&lt;/P&gt;&lt;P&gt;          data          = tb_result&lt;/P&gt;&lt;P&gt;        EXCEPTIONS&lt;/P&gt;&lt;P&gt;          tcpip_error   = 1&lt;/P&gt;&lt;P&gt;          command_error = 2&lt;/P&gt;&lt;P&gt;          data_error    = 3&lt;/P&gt;&lt;P&gt;          OTHERS        = 4.                                "#EC *&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then in your put command just pass the file name, no path is required.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;your  CMD = put /interface/outbound/test.dat test.dat &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; put 'sourcerfile' 'targetfile'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please try with this ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Savitha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 Dec 2008 06:06:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-executing-ftp-command/m-p/4955214#M1155321</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-12-23T06:06:44Z</dc:date>
    </item>
    <item>
      <title>Re: Problem executing FTP command</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/problem-executing-ftp-command/m-p/4955215#M1155322</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank You.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Sep 2009 12:52:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/problem-executing-ftp-command/m-p/4955215#M1155322</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-28T12:52:40Z</dc:date>
    </item>
  </channel>
</rss>

