<?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: FTP_CONNECT in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/ftp-connect/m-p/2039164#M419145</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I still dont understand why i need to find list of directory. I simply need to put a txt file onto another ftp server&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 27 Mar 2007 21:42:50 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-03-27T21:42:50Z</dc:date>
    <item>
      <title>FTP_CONNECT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ftp-connect/m-p/2039162#M419143</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I want to FTP a file. Can anyone explain me HANDLE . Also do I need DATA = MTAB_DATA. I am not sure about the purpose of this internal table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  CALL FUNCTION 'FTP_CONNECT'
    EXPORTING
      USER            = 'userid'
      PASSWORD        = MC_PASSWORD
      HOST            = 'servername'
      RFC_DESTINATION = 'SAPFTP'
    IMPORTING
      HANDLE          = MI_HANDLE
    EXCEPTIONS
      NOT_CONNECTED   = 1
      OTHERS          = 2.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Mar 2007 20:48:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ftp-connect/m-p/2039162#M419143</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-27T20:48:29Z</dc:date>
    </item>
    <item>
      <title>Re: FTP_CONNECT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ftp-connect/m-p/2039163#M419144</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;Handle is refer to FTP session.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you referring MTAB_DATA to this sample codes.&lt;/P&gt;&lt;P&gt;If you are, the you need to declare MTAB_DATA which will be used to receive the result from FM FTP_COMMAND. This example will return list of directory for the current FTP session.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
HANDLE = MI_HANDLE
COMMAND = 'dir'
TABLES
DATA = MTAB_DATA
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3
OTHERS = 4.

IF SY-SUBRC = 0.
LOOP AT MTAB_DATA.
WRITE: / MTAB_DATA.
ENDLOOP.
ELSE.
* do some error checking.
ENDIF.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ferry Lianto&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Mar 2007 21:13:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ftp-connect/m-p/2039163#M419144</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-27T21:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: FTP_CONNECT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ftp-connect/m-p/2039164#M419145</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I still dont understand why i need to find list of directory. I simply need to put a txt file onto another ftp server&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Mar 2007 21:42:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ftp-connect/m-p/2039164#M419145</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-27T21:42:50Z</dc:date>
    </item>
    <item>
      <title>Re: FTP_CONNECT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ftp-connect/m-p/2039165#M419146</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Megan.&lt;/P&gt;&lt;P&gt;I finally got it right. You need to first download your file then use command put to place the file on the remote server. My code looks like this. 2 performs one to create the file and then the second will place it on the destination server. Hopes will help you. The put command and docid is that of the file in the local folder that you change using the command lsd p_path.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Marius&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM download USING p_file_name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DATA: w_lfile       LIKE rlgrap-filename,&lt;/P&gt;&lt;P&gt;        w_lf(5)       TYPE c,&lt;/P&gt;&lt;P&gt;        w_message     TYPE string,&lt;/P&gt;&lt;P&gt;        w_string(500) TYPE c.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ddocid = p_file_name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create file on Source&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      text = 'Create File on Local server'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CONCATENATE p_path p_file_name INTO w_lfile.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF sy-batch = 'X'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Opens file for output in text mode&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    OPEN DATASET w_lfile&lt;/P&gt;&lt;P&gt;        FOR OUTPUT IN TEXT MODE ENCODING DEFAULT&lt;/P&gt;&lt;P&gt;                                MESSAGE w_message.&lt;/P&gt;&lt;P&gt;    IF sy-subrc NE 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; RAISE INVALID_FILEPATH.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      MESSAGE e001(00) WITH w_message.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Transfers each line of the internal table to the file&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    LOOP AT it_output.&lt;/P&gt;&lt;P&gt;      w_string = it_output-line.&lt;/P&gt;&lt;P&gt;      MOVE cl_abap_char_utilities=&amp;gt;cr_lf TO w_lf.&lt;/P&gt;&lt;P&gt;      CONCATENATE w_string w_lf INTO w_string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      TRANSFER w_string TO w_lfile NO END OF LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CLOSE DATASET w_lfile.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;P&gt;    CALL METHOD cl_download-&amp;gt;gui_download&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        filename                = p_file_name&lt;/P&gt;&lt;P&gt;        filetype                = 'ASC'&lt;/P&gt;&lt;P&gt;      CHANGING&lt;/P&gt;&lt;P&gt;        data_tab                = it_output[]&lt;/P&gt;&lt;P&gt;      EXCEPTIONS&lt;/P&gt;&lt;P&gt;        file_write_error        = 1&lt;/P&gt;&lt;P&gt;        no_batch                = 2&lt;/P&gt;&lt;P&gt;        gui_refuse_filetransfer = 3&lt;/P&gt;&lt;P&gt;        invalid_type            = 4&lt;/P&gt;&lt;P&gt;        no_authority            = 5&lt;/P&gt;&lt;P&gt;        unknown_error           = 6&lt;/P&gt;&lt;P&gt;        header_not_allowed      = 7&lt;/P&gt;&lt;P&gt;        separator_not_allowed   = 8&lt;/P&gt;&lt;P&gt;        filesize_not_allowed    = 9&lt;/P&gt;&lt;P&gt;        header_too_long         = 10&lt;/P&gt;&lt;P&gt;        dp_error_create         = 11&lt;/P&gt;&lt;P&gt;        dp_error_send           = 12&lt;/P&gt;&lt;P&gt;        dp_error_write          = 13&lt;/P&gt;&lt;P&gt;        unknown_dp_error        = 14&lt;/P&gt;&lt;P&gt;        access_denied           = 15&lt;/P&gt;&lt;P&gt;        dp_out_of_memory        = 16&lt;/P&gt;&lt;P&gt;        disk_full               = 17&lt;/P&gt;&lt;P&gt;        dp_timeout              = 18&lt;/P&gt;&lt;P&gt;        file_not_found          = 19&lt;/P&gt;&lt;P&gt;        dataprovider_exception  = 20&lt;/P&gt;&lt;P&gt;        control_flush_error     = 21&lt;/P&gt;&lt;P&gt;        not_supported_by_gui    = 22&lt;/P&gt;&lt;P&gt;        error_no_gui            = 23.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.                    " download&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM ftp_file USING p_file_name.&lt;/P&gt;&lt;P&gt;  DATA: w_cmd1(120),&lt;/P&gt;&lt;P&gt;        w_cmd2(120),&lt;/P&gt;&lt;P&gt;        w_cmd3(120),&lt;/P&gt;&lt;P&gt;        w_cmd4(120),&lt;/P&gt;&lt;P&gt;        w_cmd5(120).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Change to ascii process status&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  cmd = 'ascii'.&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'FTP_COMMAND'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      handle        = w_handle&lt;/P&gt;&lt;P&gt;      command       = cmd&lt;/P&gt;&lt;P&gt;      compress      = 'N'&lt;/P&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      data          = result&lt;/P&gt;&lt;P&gt;    EXCEPTIONS&lt;/P&gt;&lt;P&gt;      command_error = 1&lt;/P&gt;&lt;P&gt;      tcpip_error   = 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Change local path to where file was downloaded&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CONCATENATE 'lcd' p_path INTO cmd SEPARATED BY ' '.&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'FTP_COMMAND'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      handle        = w_handle&lt;/P&gt;&lt;P&gt;      command       = cmd&lt;/P&gt;&lt;P&gt;      compress      = 'N'&lt;/P&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      data          = result&lt;/P&gt;&lt;P&gt;    EXCEPTIONS&lt;/P&gt;&lt;P&gt;      command_error = 1&lt;/P&gt;&lt;P&gt;      tcpip_error   = 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Create file on Source&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      text = 'Placing file on Destination server'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Put new file on remote system&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  CONCATENATE 'put' ddocid INTO cmd SEPARATED BY ' '.&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'FTP_COMMAND'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      handle        = w_handle&lt;/P&gt;&lt;P&gt;      command       = cmd&lt;/P&gt;&lt;P&gt;      compress      = 'N'&lt;/P&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      data          = result&lt;/P&gt;&lt;P&gt;    EXCEPTIONS&lt;/P&gt;&lt;P&gt;      command_error = 1&lt;/P&gt;&lt;P&gt;      tcpip_error   = 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.                    " ftp_file&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Mar 2007 12:08:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ftp-connect/m-p/2039165#M419146</guid>
      <dc:creator>marius_greeff</dc:creator>
      <dc:date>2007-03-30T12:08:39Z</dc:date>
    </item>
    <item>
      <title>Re: FTP_CONNECT</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ftp-connect/m-p/2039166#M419147</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Megan Flores,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In Function moduel FTP_CONNECT, we pass the User name and the Scambled password with Server name and the Destination, adn we recive the message from the FTP whether we successfully conected or not,&lt;/P&gt;&lt;P&gt; in the field MI_HANDLE, you will get whehter the FTP is success or not, it is equals to SY-SUBRC in Namal ABAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Aftter that you  need to call the Function module FTP_COMMAND, to pass a command to the FTP to place a Txt fiel over there&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>Fri, 30 Mar 2007 12:23:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ftp-connect/m-p/2039166#M419147</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-03-30T12:23:34Z</dc:date>
    </item>
  </channel>
</rss>

