Copyright 2024 - BV TallVision IT

When working files for interfacing, it could be a requirement to FTP something to it's final (or semi final) destination. Often a basis theme, but it can also be arranged from an Abap: 

There's a set of function modules that can be used to compose an FTP session, with actual GET or PUT actions. Here's a brief run through a PUT script: 

Open the FTP connection for which the usual credentials are required. Call function module FTP_CONNECTwith the username, password, host and RFC destination. 

  CALL FUNCTION 'FTP_CONNECT'
    EXPORTING
      user            = 'Gord0n'
      password        = 'KillCust0mer'
      host            = 'examplefrp.com'
      rfc_destination = 'SAPRFC'
    IMPORTING
      handle          = lv_ftp_handle "Type i
    EXCEPTIONS
      not_connected   = 1
      OTHERS          = 2.

Compose the commands list. Once the connection is opened, a list of commands can be issued via FTP_COMMAND_LIST. In this example we well change directory using CD and PUT our file somewhere. Note there is also a function FTP_COMMAND if there is only a single command to be processed.

  DATA: lt_commands type standard table of char200, 
             lt_result type standard table of char255. 

  append 'cd mysubfolder' to lt_commands.
  append 'put myfile.source yourfile.target' to lt_commands. 

  CALL FUNCTION 'FTP_COMMAND_LIST'
    EXPORTING
      handle        = lv_ftp_handle
    TABLES
      data          = lt_result
      commands      = lt_commands
    EXCEPTIONS
      tcpip_error   = 1
      command_error = 2
      data_error    = 3
      OTHERS        = 4.

Close the connection needs to be done, so make sure you include this.

  CALL FUNCTION 'FTP_DISCONNECT'
    EXPORTING
      handle = lv_ftp_handle.

Check out a full blown tutorial on using these modules here: http://wiki.scn.sap.com/wiki/display/ABAP/The+SAPFTP+Library+-+FTP+Programming+in+ABAP