Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

File Transfer Toolusing File Trandsfer Protocol

Former Member
0 Likes
351

Hi All,

I am preparing a file transfer tool for transfering files from SAP to non SAP sysem and also Viceversa.

I need to use FILE TRANSFER PROTOCOL for the tool.

Can some body helps me out how to proceed and what all function modules can be used for the same.

Remember that i need to use only FILE TRANSFER PROTOCOL.

Please help me out.

Thanks

1 REPLY 1
Read only

Former Member
0 Likes
314

Hi Himanshu,

See the below code for your requirement.


    g_dlen = STRLEN( p_pwd ).
 
***Below Function module is used to Encrypt the Password
  CALL FUNCTION 'HTTP_SCRAMBLE'
    EXPORTING
      SOURCE      = p_pwd "Actual password
      sourcelen   = g_dlen
      key         = c_key
    IMPORTING
      destination = g_dpwd. "Encyrpted Password
 
 
  CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
    EXPORTING
      text = 'Connecting to FTP Server'(300).
 
***Connecting to FTP Server
  CALL FUNCTION 'FTP_CONNECT'
    EXPORTING
      user            = p_user
      password        = g_dpwd
      host            = p_path
      rfc_destination = c_dest
    IMPORTING
      handle          = g_dhdl
    EXCEPTIONS
      not_connected   = 1
      OTHERS          = 2.
  IF sy-subrc NE 0.
    MESSAGE s000 WITH 'Error in Connection'(250).
  ELSE.
    MESSAGE s000 WITH 'FTP Connection is Opened'(251).
  ENDIF.
 
 
***Transferring the data from internal table to FTP Server.
  CALL FUNCTION 'FTP_R3_TO_SERVER'
    EXPORTING
      handle         = g_dhdl
      fname          = g_filename
      character_mode = c_x
    TABLES
      text           = lt_table
    EXCEPTIONS
      tcpip_error    = 1
      command_error  = 2
      data_error     = 3
      OTHERS         = 4.
 
  IF sy-subrc NE 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ELSE.
    MESSAGE s000 WITH 'File Has Been Created on FTP Server'(252).
  ENDIF.
 
 
 
**To Disconnect the FTP Server
  CALL FUNCTION 'FTP_DISCONNECT'
    EXPORTING
      handle = g_dhdl.
 

  

Regards,

Vimal.