<?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 to a server in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/ftp-to-a-server/m-p/2884013#M677427</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;This program is useful if you want to move the data from internal table to a file on to the external server.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In other words this program will create a file on the external server with the data which is available on the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Replace 'XXX.XXX.XX.XXX' with your host name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the below code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tables: t777a.                        "Building Addresses&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Internal Table for  Building table.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;data: begin of it_t777a occurs 0,&lt;/P&gt;&lt;P&gt;        build like t777a-build,       "Building&lt;/P&gt;&lt;P&gt;        stext like t777a-stext,       "Object Name&lt;/P&gt;&lt;P&gt;        cname like t777a-cname,       "Address Supplement (c/o)&lt;/P&gt;&lt;P&gt;        ort01 like t777a-ort01,       "City&lt;/P&gt;&lt;P&gt;        pstlz like t777a-pstlz,       "Postal Code&lt;/P&gt;&lt;P&gt;        regio like t777a-regio,       "Region (State, Province, County)&lt;/P&gt;&lt;P&gt;      end of it_t777a.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Internal Table for taking all fields of the above table in one line&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;separated by &amp;#145;|&amp;#146;(pipe).&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of it_text occurs 0,&lt;/P&gt;&lt;P&gt;      text(131),&lt;/P&gt;&lt;P&gt;      end of it_text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Constants: c_key  type i value 26101957,&lt;/P&gt;&lt;P&gt;           c_dest   type rfcdes-rfcdest value 'SAPFTPA'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: g_dhdl type i,      "Handle&lt;/P&gt;&lt;P&gt;      g_dlen type i,      "pass word length&lt;/P&gt;&lt;P&gt;      g_dpwd(30).         "For storing password&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;Selection Screen Starts&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE TEXT-001.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;parameters: p_user(30) default 't777a'          obligatory,&lt;/P&gt;&lt;P&gt;            p_pwd(30)  default 't777a'          obligatory,&lt;/P&gt;&lt;P&gt;            p_host(64) default 'XXX.XXX.XX.XXX' obligatory.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN END OF BLOCK blk1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE TEXT-002.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;parameters: p_file like rlgrap-filename default 't777a_feed.txt'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN END OF BLOCK blk2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Password not visible.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;at Selection-screen output.&lt;/P&gt;&lt;P&gt;  loop at screen.&lt;/P&gt;&lt;P&gt;    if screen-name = 'P_PWD'.&lt;/P&gt;&lt;P&gt;      screen-invisible = '1'.&lt;/P&gt;&lt;P&gt;      modify screen.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;g_dpwd  = p_pwd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Start of selection&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;To fetch the data records from the table T777A.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  select build stext cname ort01 pstlz regio&lt;/P&gt;&lt;P&gt;         from t777a&lt;/P&gt;&lt;P&gt;         into table it_t777a.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Sort the internal table by build.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  if not it_t777a[] is initial.&lt;/P&gt;&lt;P&gt;    sort it_t777a by build.&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;Concatenate all the fields of above internal table records in one line&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;separated by &amp;#145;|&amp;#146;(pipe).&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  loop at it_t777a.&lt;/P&gt;&lt;P&gt;    concatenate it_t777a-build it_t777a-stext it_t777a-cname&lt;/P&gt;&lt;P&gt;                it_t777a-ort01 it_t777a-pstlz it_t777a-regio&lt;/P&gt;&lt;P&gt;                into it_text-text separated by '|'.&lt;/P&gt;&lt;P&gt;    append it_text.&lt;/P&gt;&lt;P&gt;    clear it_text.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt; To get the length of the password.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  g_dlen = strlen( g_dpwd ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;Below Function module is used to Encrypt the Password.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'HTTP_SCRAMBLE'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      SOURCE      = g_dpwd          "Actual password&lt;/P&gt;&lt;P&gt;      SOURCELEN   = g_dlen&lt;/P&gt;&lt;P&gt;      KEY         = c_key&lt;/P&gt;&lt;P&gt;    IMPORTING&lt;/P&gt;&lt;P&gt;      DESTINATION = g_dpwd.         "Encyrpted Password&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Connects to the FTP Server as specified by user.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Call function 'SAPGUI_PROGRESS_INDICATOR'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      text = 'Connecting to FTP Server'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;Below function module is used to connect the FTP Server.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;It Accepts only Encrypted Passwords.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;This Function module will provide a handle to perform different&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;operations on the FTP Server via FTP Commands.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&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;      user            = p_user&lt;/P&gt;&lt;P&gt;      password        = g_dpwd&lt;/P&gt;&lt;P&gt;      host            = p_host&lt;/P&gt;&lt;P&gt;      rfc_destination = c_dest&lt;/P&gt;&lt;P&gt;    IMPORTING&lt;/P&gt;&lt;P&gt;      handle          = g_dhdl&lt;/P&gt;&lt;P&gt;     EXCEPTIONS&lt;/P&gt;&lt;P&gt;        NOT_CONNECTED.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;    format color col_negative.&lt;/P&gt;&lt;P&gt;    write:/ 'Error in Connection'.&lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;    write:/ 'FTP Connection is opened '.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**Transferring the data from internal table to FTP Server.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'FTP_R3_TO_SERVER'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      HANDLE         = g_dhdl&lt;/P&gt;&lt;P&gt;      FNAME          = p_file&lt;/P&gt;&lt;P&gt;      CHARACTER_MODE = 'X'&lt;/P&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      TEXT           = it_text&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 &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;P&gt;            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;P&gt;    write:/ 'File has created on FTP Server'.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Call function 'SAPGUI_PROGRESS_INDICATOR'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      text = 'File has created on FTP Server'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;To Disconnect the FTP Server.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'FTP_DISCONNECT'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      HANDLE = g_dhdl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;To Disconnect the Destination.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;  CALL FUNCTION 'RFC_CONNECTION_CLOSE'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      destination = c_dest&lt;/P&gt;&lt;P&gt;    EXCEPTIONS&lt;/P&gt;&lt;P&gt;      others      = 1.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 02 Oct 2007 12:38:32 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-10-02T12:38:32Z</dc:date>
    <item>
      <title>ftp to a server</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ftp-to-a-server/m-p/2884011#M677425</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to ftp a file from the local drive to one of the servers on the landscape. I have the following information:&lt;/P&gt;&lt;P&gt;1. hostname,&lt;/P&gt;&lt;P&gt;2. IP&lt;/P&gt;&lt;P&gt;3. username&lt;/P&gt;&lt;P&gt;4. password&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can u please advise on the code to use the above paramaters and ftp the file. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;fs&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Oct 2007 12:14:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ftp-to-a-server/m-p/2884011#M677425</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-02T12:14:16Z</dc:date>
    </item>
    <item>
      <title>Re: ftp to a server</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ftp-to-a-server/m-p/2884012#M677426</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Here is the sample code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT ZFTPSAP LINE-SIZE 132.

DATA: BEGIN OF MTAB_DATA OCCURS 0,
LINE(132) TYPE C,
END OF MTAB_DATA.

DATA: MC_PASSWORD(20) TYPE C,
MI_KEY TYPE I VALUE 26101957,
MI_PWD_LEN TYPE I,
MI_HANDLE TYPE I.

START-OF-SELECTION.

*-- Your SAP-UNIX FTP password (case sensitive)
MC_PASSWORD = 'password'.

DESCRIBE FIELD MC_PASSWORD LENGTH MI_PWD_LEN.

*-- FTP_CONNECT requires an encrypted password to work
CALL 'AB_RFC_X_SCRAMBLE_STRING'
     ID 'SOURCE' FIELD MC_PASSWORD ID 'KEY' FIELD MI_KEY
     ID 'SCR' FIELD 'X' ID 'DESTINATION' FIELD MC_PASSWORD
     ID 'DSTLEN' FIELD MI_PWD_LEN.

CALL FUNCTION 'FTP_CONNECT'
     EXPORTING
*-- Your SAP-UNIX FTP user name (case sensitive)
       USER            = 'userid'
       PASSWORD        = MC_PASSWORD
*-- Your SAP-UNIX server host name (case sensitive)
       HOST            = 'unix-host'
       RFC_DESTINATION = 'SAPFTP'
     IMPORTING
       HANDLE          = MI_HANDLE
     EXCEPTIONS
       NOT_CONNECTED   = 1
       OTHERS          = 2.

CHECK SY-SUBRC = 0.

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.
  WRITE: / 'Error in FTP Command'.
ENDIF.

CALL FUNCTION 'FTP_DISCONNECT'
     EXPORTING
       HANDLE = MI_HANDLE
     EXCEPTIONS
       OTHERS = 1.   &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &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, 02 Oct 2007 12:15:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ftp-to-a-server/m-p/2884012#M677426</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-02T12:15:42Z</dc:date>
    </item>
    <item>
      <title>Re: ftp to a server</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ftp-to-a-server/m-p/2884013#M677427</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;This program is useful if you want to move the data from internal table to a file on to the external server.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In other words this program will create a file on the external server with the data which is available on the internal table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Replace 'XXX.XXX.XX.XXX' with your host name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check the below code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tables: t777a.                        "Building Addresses&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Internal Table for  Building table.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;data: begin of it_t777a occurs 0,&lt;/P&gt;&lt;P&gt;        build like t777a-build,       "Building&lt;/P&gt;&lt;P&gt;        stext like t777a-stext,       "Object Name&lt;/P&gt;&lt;P&gt;        cname like t777a-cname,       "Address Supplement (c/o)&lt;/P&gt;&lt;P&gt;        ort01 like t777a-ort01,       "City&lt;/P&gt;&lt;P&gt;        pstlz like t777a-pstlz,       "Postal Code&lt;/P&gt;&lt;P&gt;        regio like t777a-regio,       "Region (State, Province, County)&lt;/P&gt;&lt;P&gt;      end of it_t777a.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Internal Table for taking all fields of the above table in one line&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;separated by &amp;#145;|&amp;#146;(pipe).&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of it_text occurs 0,&lt;/P&gt;&lt;P&gt;      text(131),&lt;/P&gt;&lt;P&gt;      end of it_text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Constants: c_key  type i value 26101957,&lt;/P&gt;&lt;P&gt;           c_dest   type rfcdes-rfcdest value 'SAPFTPA'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: g_dhdl type i,      "Handle&lt;/P&gt;&lt;P&gt;      g_dlen type i,      "pass word length&lt;/P&gt;&lt;P&gt;      g_dpwd(30).         "For storing password&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;Selection Screen Starts&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE TEXT-001.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;parameters: p_user(30) default 't777a'          obligatory,&lt;/P&gt;&lt;P&gt;            p_pwd(30)  default 't777a'          obligatory,&lt;/P&gt;&lt;P&gt;            p_host(64) default 'XXX.XXX.XX.XXX' obligatory.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN END OF BLOCK blk1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE TEXT-002.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;parameters: p_file like rlgrap-filename default 't777a_feed.txt'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECTION-SCREEN END OF BLOCK blk2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Password not visible.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;at Selection-screen output.&lt;/P&gt;&lt;P&gt;  loop at screen.&lt;/P&gt;&lt;P&gt;    if screen-name = 'P_PWD'.&lt;/P&gt;&lt;P&gt;      screen-invisible = '1'.&lt;/P&gt;&lt;P&gt;      modify screen.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;g_dpwd  = p_pwd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Start of selection&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;To fetch the data records from the table T777A.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  select build stext cname ort01 pstlz regio&lt;/P&gt;&lt;P&gt;         from t777a&lt;/P&gt;&lt;P&gt;         into table it_t777a.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Sort the internal table by build.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  if not it_t777a[] is initial.&lt;/P&gt;&lt;P&gt;    sort it_t777a by build.&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;Concatenate all the fields of above internal table records in one line&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;separated by &amp;#145;|&amp;#146;(pipe).&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  loop at it_t777a.&lt;/P&gt;&lt;P&gt;    concatenate it_t777a-build it_t777a-stext it_t777a-cname&lt;/P&gt;&lt;P&gt;                it_t777a-ort01 it_t777a-pstlz it_t777a-regio&lt;/P&gt;&lt;P&gt;                into it_text-text separated by '|'.&lt;/P&gt;&lt;P&gt;    append it_text.&lt;/P&gt;&lt;P&gt;    clear it_text.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt; To get the length of the password.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  g_dlen = strlen( g_dpwd ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;Below Function module is used to Encrypt the Password.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'HTTP_SCRAMBLE'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      SOURCE      = g_dpwd          "Actual password&lt;/P&gt;&lt;P&gt;      SOURCELEN   = g_dlen&lt;/P&gt;&lt;P&gt;      KEY         = c_key&lt;/P&gt;&lt;P&gt;    IMPORTING&lt;/P&gt;&lt;P&gt;      DESTINATION = g_dpwd.         "Encyrpted Password&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Connects to the FTP Server as specified by user.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Call function 'SAPGUI_PROGRESS_INDICATOR'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      text = 'Connecting to FTP Server'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;Below function module is used to connect the FTP Server.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;It Accepts only Encrypted Passwords.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;This Function module will provide a handle to perform different&lt;/P&gt;&lt;/LI&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;operations on the FTP Server via FTP Commands.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&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;      user            = p_user&lt;/P&gt;&lt;P&gt;      password        = g_dpwd&lt;/P&gt;&lt;P&gt;      host            = p_host&lt;/P&gt;&lt;P&gt;      rfc_destination = c_dest&lt;/P&gt;&lt;P&gt;    IMPORTING&lt;/P&gt;&lt;P&gt;      handle          = g_dhdl&lt;/P&gt;&lt;P&gt;     EXCEPTIONS&lt;/P&gt;&lt;P&gt;        NOT_CONNECTED.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;    format color col_negative.&lt;/P&gt;&lt;P&gt;    write:/ 'Error in Connection'.&lt;/P&gt;&lt;P&gt;  else.&lt;/P&gt;&lt;P&gt;    write:/ 'FTP Connection is opened '.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;**Transferring the data from internal table to FTP Server.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'FTP_R3_TO_SERVER'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      HANDLE         = g_dhdl&lt;/P&gt;&lt;P&gt;      FNAME          = p_file&lt;/P&gt;&lt;P&gt;      CHARACTER_MODE = 'X'&lt;/P&gt;&lt;P&gt;    TABLES&lt;/P&gt;&lt;P&gt;      TEXT           = it_text&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 &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;P&gt;            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;P&gt;    write:/ 'File has created on FTP Server'.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Call function 'SAPGUI_PROGRESS_INDICATOR'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      text = 'File has created on FTP Server'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;To Disconnect the FTP Server.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CALL FUNCTION 'FTP_DISCONNECT'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      HANDLE = g_dhdl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt;To Disconnect the Destination.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;  CALL FUNCTION 'RFC_CONNECTION_CLOSE'&lt;/P&gt;&lt;P&gt;    EXPORTING&lt;/P&gt;&lt;P&gt;      destination = c_dest&lt;/P&gt;&lt;P&gt;    EXCEPTIONS&lt;/P&gt;&lt;P&gt;      others      = 1.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Oct 2007 12:38:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ftp-to-a-server/m-p/2884013#M677427</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-10-02T12:38:32Z</dc:date>
    </item>
    <item>
      <title>Re: ftp to a server</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ftp-to-a-server/m-p/2884014#M677428</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;or try sample-report RSFTP004&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 02 Oct 2007 13:21:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ftp-to-a-server/m-p/2884014#M677428</guid>
      <dc:creator>andreas_mann3</dc:creator>
      <dc:date>2007-10-02T13:21:05Z</dc:date>
    </item>
    <item>
      <title>Re: ftp to a server</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/ftp-to-a-server/m-p/2884015#M677429</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for ur response. The code worked great&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Nov 2007 03:36:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/ftp-to-a-server/m-p/2884015#M677429</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-22T03:36:05Z</dc:date>
    </item>
  </channel>
</rss>

