César,
Hola...Aqui te dejo un codigo fuente para realizar FTP.
Espero que esto te ayude...
REPORT Y_EBF_PRUEBAS_FTP.
*----------------------------------------------------------------------*
* DECLARACION GLOBAL DE DATOS
*----------------------------------------------------------------------*
DATA: BEGIN OF tbi_ftp_result OCCURS 0,
line(100) TYPE c,
END OF tbi_ftp_result.
*
DATA : w_nomb_arch LIKE rlgrap-filename.
DATA : w_nomb_sali TYPE string.
*
*
*----------------------------------------------------------------------*
* SELECTION-SCREEN
*----------------------------------------------------------------------*
SELECTION-SCREEN: BEGIN OF BLOCK b01 WITH FRAME TITLE txt001.
*----------> Usuario FTP
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 01(45) txt020 FOR FIELD p_user.
PARAMETERS: p_user(30) TYPE c LOWER CASE DEFAULT 'UserName'.
SELECTION-SCREEN END OF LINE.
*
*----------> Password Usuario FTP
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 01(45) txt022 FOR FIELD p_pwd.
PARAMETERS: p_pwd(30) TYPE c LOWER CASE DEFAULT 'PassWord'.
SELECTION-SCREEN END OF LINE.
*
*----------> Direccion IP del Servidor FTP
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 01(45) txt024 FOR FIELD p_host.
PARAMETERS: p_host(64) TYPE c LOWER CASE DEFAULT '192.XXX.XXX.XX'.
SELECTION-SCREEN END OF LINE.
*
*----------> Directorio de Destino Servidor FTP
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 01(45) txt026 FOR FIELD p_cmd1.
PARAMETERS: p_cmd1(80) TYPE c LOWER CASE DEFAULT '/DATA'.
SELECTION-SCREEN END OF LINE.
*
*----------> Destino RFC para Servicio FTP de SAP
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 01(45) txt028 FOR FIELD p_dest.
PARAMETERS: p_dest LIKE rfcdes-rfcdest DEFAULT 'SAPFTPA'.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN: END OF BLOCK b01.
*----------------------------------------------------------------------*
* LLAMA RUTINA FTP
*----------------------------------------------------------------------*
PERFORM envia_ftp USING w_nomb_arch w_nomb_sali.
*----------------------------------------------------------------------*
* INITIALIZATION
*----------------------------------------------------------------------*
INITIALIZATION.
*
txt001 = 'TEST DE FTP - SERVER SAP A OTRO'.
*
txt020 = 'Usuario FTP'.
txt022 = 'Password FTP'.
txt024 = 'IP Servidor FTP'.
txt026 = 'Directorio Destino FTP'.
txt028 = 'Destino lógico RFC'.
*----------------------------------------------------------------------*
* FORM : ENVIA_FTP
*----------------------------------------------------------------------*
FORM envia_ftp USING p_w_nomb_arch
p_nom_sali.
*
DATA : user(30) TYPE c,
pwd(30) TYPE c,
host(64) TYPE c,
cmd0(256) TYPE c,
cmd1(256) TYPE c,
cmd2(256) TYPE c,
cmd3(256) TYPE c,
dest LIKE rfcdes-rfcdest,
compress TYPE c VALUE 'N'.
*
DATA: hdl TYPE i,
key TYPE i VALUE 26101957,
slen TYPE i.
*
DATA : w_status(1) TYPE c.
DATA: BEGIN OF result OCCURS 0,
line(100) TYPE c,
END OF result.
DATA : w_result LIKE result.
*
w_status = 'F'.
user = p_user.
pwd = p_pwd.
host = p_host.
dest = p_dest.
*
CONCATENATE '/'
p_cmd1
INTO cmd0.
*
CONCATENATE 'cd'
cmd0
INTO cmd1 SEPARATED BY space.
CONCATENATE 'put'
p_w_nomb_arch
p_nom_sali
INTO cmd2 SEPARATED BY space.
*
SET EXTENDED CHECK OFF.
slen = STRLEN( pwd ).
*
CALL FUNCTION 'HTTP_SCRAMBLE'
EXPORTING
SOURCE = pwd
sourcelen = slen
key = key
IMPORTING
destination = pwd.
*
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
user = user
password = pwd
host = host
rfc_destination = dest
IMPORTING
handle = hdl
EXCEPTIONS
not_connected = 1
OTHERS = 2.
*
IF ( sy-subrc EQ 0 ).
*
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = hdl
command = cmd1
compress = compress
TABLES
data = result
EXCEPTIONS
command_error = 1
tcpip_error = 2.
IF ( sy-subrc EQ 0 ).
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = hdl
command = cmd2
TABLES
data = tbi_ftp_result
EXCEPTIONS
command_error = 1
tcpip_error = 2.
*
IF ( sy-subrc EQ 0 ).
w_status = 'T' .
ENDIF.
ENDIF.
*
CALL FUNCTION 'FTP_DISCONNECT'
EXPORTING
handle = hdl.
*
CALL FUNCTION 'RFC_CONNECTION_CLOSE'
EXPORTING
destination = dest
EXCEPTIONS
OTHERS = 1.
*
ENDIF.
*------>>> SI SE REALIZA LA TRANSFERENCIA FTP - SE ELIMINA EL ARCHIVO DESDE EL SERVIDOR
IF ( w_status EQ 'T' ).
DELETE DATASET p_w_nomb_arch.
ENDIF.
*
ENDFORM. "