SAP provide sample code to connect to FTP.
It provided in SAP
function module, FTP_CONNECT (connect to FTP), FTP_COMMAND (send command
by FTP), FTP_DISCONNECT (disconnect),FTP_R3_TO_SERVER (put file to
FTP),FTP_SERVER_TO_R3 (get file from FTP).
Instead of writing a new code, I will try to give you explanation on SAP sample code.
I will explore program RSFTP002.
You can send any FTP command by this program.
For
RFC destination use SAPFTP or SAPFTPA. Those are standard RFC
destination to connect to FTP. SAPFTP run on client, and SAPFTPA run on
application server.
First step of this program is using FTP_CONNECT, don't forget to use scrambled password.
Then we send a command to FTP by using FTP_COMMAND.
To disconnect, use FTP_DISCONNECT.
To
copy, or get a file from SAP to/from FTP, you can explore RSFTP002. It
demonstrate how to use FTP_R3_TO_SERVER (put file to FTP) &
FTP_SERVER_TO_R3 (get file from FTP).
Other way is send put command using FTP_COMMAND. To put a file, do this steps, change FTP directory using "cd dir", change local directory using "lcd localdir", then send put command "put file".
Serkan AKKAVAK
Computer Engineer
SAP Department Deputy Manager
Contact : serkurumsal@yandex.com
Social Plugin