Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

<p>The Function module <b>GUI_DOWNLOAD</b> is used to download the data into <b>presentation server</b> and <b>Dataset</b> concepts to download the data into <b>Application server</b>. Sometimes we may require to download the data into other system (<b>3rd Party System</b>) from SAP.

In such scenarios, the concept of <b>FTP</b> commands comes into picture through which data (<b>internal table data</b>) from SAP can be transffered to other system.</p>

<p>This scenarios can be achieved through SAP using the <b>FTP</b> Commands which are available within SAP. The data gets transferred to other systems. The concept is that the internal table data will be placed as a file in other systems using the FTP concept.</p>

<p>The various FTP commands which are needed for this prupose are HTTP_SCRAMBLE, FTP_CONNECT, FTP_R3_TO_SERVER, FTP_DISCONNECT, RFC_CONNECTION_CLOSE function modules.</p>

<p><b>HTTP_SCRAMBLE</b>: This is used to scramble the password provided into a format which is been recognized by SAP.</p>

<p>l_pwd = p_pwd.</p>

<p>l_slen = STRLEN(

l_pwd ).</p>

<p>CALL FUNCTION

'HTTP_SCRAMBLE'</p>

<p>exporting</p>

<p>source = l_pwd</p>

<p>sourcelen = l_slen</p>

<p>key = c_key</p>

<p>importing</p>

<p>destination = l_pwd.</p>

<p><b>FTP_CONNECT</b> :

This is used to connect to other system from SAP with the help of Userid & amp;

scrambled password & Host string & destination (default 'SAPFTP').</p>

<p>* To Connect to the Server using FTP</p>

<p>CALL FUNCTION 'FTP_CONNECT'</p>

<p>EXPORTING</p>

<p>user = p_user</p>

<p>password = l_pwd</p>

<p>host = p_host</p>

<p>rfc_destination = c_dest</p>

<p>IMPORTING</p>

<p>handle = w_hdl</p>

<p>EXCEPTIONS</p>

<p>OTHERS = 1.</p>

<p>IF sy-subrc <> 0.</p>

<p>MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno</p>

<p>WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.</p>

<p>ENDIF.</p>

<p><b>FTP_R3_TO_SERVER</b>This is used to transfer the

internal table data as a file to other system in the character mode.</p>

<p>CALL FUNCTION 'FTP_R3_TO_SERVER'</p>

<p>EXPORTING</p>

<p>handle = w_hdl</p>

<p>fname = <file path of destination system></p>

<p>character_mode = 'X'</p>

<p>TABLES</p>

<p>text = <internal table data></p>

<p>EXCEPTIONS</p>

<p>tcpip_error = 1</p>

<p>command_error = 2</p>

<p>data_error = 3</p>

<p>OTHERS = 4.</p>

<p>IF sy-subrc <> 0.</p>

<p>MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno</p>

<p>WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4</p>

<p>RAISING invalid_output_file.</p>

<p>ENDIF.</p>

<p><b>FTP_DISCONNECT:</b> This is used to disconnect the

connection between SAP and other system.</p>

<p>* To disconnect the FTP</p>

<p>CALL FUNCTION 'FTP_DISCONNECT'</p>

<p>EXPORTING</p>

<p>handle = w_hdl.</p>

<p><b>RFC_CONNECTION_CLOSE</b>: This is used to disconnect the RFC connection between SAP and other system.</p>

<p>CALL FUNCTION 'RFC_CONNECTION_CLOSE'</p>

<p>EXPORTING</p>

<p>destination = c_dest</p>

<p>EXCEPTIONS</p>

<p>OTHERS = 1.</p>

7 Comments