2008 Mar 25 11:19 AM
Hi all,
I need to transfer a file from one folder to another folder on a FTP server.
I tried using fm ftp_copy, with as FILE_SOURCE the source file (e.g. /template/a.xls) and as file destination te destination file (e.g /upload/folder/a.xls).
I receive as sy-subrc 2, (wrong ftp command).
Is there someone who knows how to do this ?
thanks !
kr
Björn
Hi all,
I need to transfer a file from one folder to another folder on a FTP server.
I tried using fm ftp_copy, with as FILE_SOURCE the source file (e.g. /template/a.xls) and as file destination te destination file (e.g /upload/folder/a.xls).
I receive as sy-subrc 2, (wrong ftp command).
Is there someone who knows how to do this ?
thanks !
kr
Björn
2008 Mar 25 11:29 AM
These are standared FTP programs which allows you to FTP from within SAP.
The SAPFTP.EXE should be pre-installed in the users local harddisk before you can used this functions.
Do a check first by executing program RSFTP005. It will tell you whether it can detect the SAPFTP.EXE program.
RSFTP001 - SAPFTP version
RSFTP002 - Execute FTP Command
RSFTP003 - Test
RSFTP004 - FTP copy
RSFTP005 - SAPFTP check
RSFTP006 - FTP command list
RSFTP007 - Test FB:FTP_SERVER_TO_R3 / FTP_R3_TO_SERVER
RSFTP008 - Test FB:FTP_CLIENT_TO_R3 / FTP_R3_TO_CLIENT
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.
Program RSFTP002 demonstrate how to send command to FTP.
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".
2008 Mar 25 1:37 PM
Apparentle, the copy-statement doesn 't exist aas a ftp-command. So I download the file using ftp_SERVER_TO_R3 and upload it to the new location using FTP_R_3_TO_SERVER
That's solved
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |