2024 Sep 11 11:46 AM
Hi,
I try to connect to an FTP server using ABAP. I want to connect with user/password, so I use the user anonymous with an email-Adresse as password.
The code looks like the following:
call function 'FTP_CONNECT'
exporting
user = 'anonymous'
password = 'my@email.com'
host = '95.31.30.236'
rfc_destination = 'SAPFTP'
importing
handle = hdl.
However, I when execute the programm, I get get the error
User anonymous is not allowed on 95.31.30.236.
But connecting to this server server using FileZilla with the same credentials, works well. So anonymous connection is allowed.
Any suggestions how to connect via ABAP using anonymous user?
Thx!
2024 Sep 11 2:14 PM
2024 Sep 11 2:25 PM
Hi & thx for your answer.
I've already tried this, without success.
In the meantime I've found out that I have to maintain the FTP whitelist via maintenance view SAPFTP_SERVERS_V. After that, the connection worked!
As the next step, I wanted to make directory listing using
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
handle = hdl
command = 'dir'
TABLES
data = mtab_data
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3
OTHERS = 4
This one fails with a COMMAND_ERROR: 502 PORT/EPRT not supported in transparent mode
Any Ideas regarding this one?
2024 Sep 11 4:24 PM
2024 Sep 11 5:16 PM
You have to use HTTP_SCRAMBLE for the password.
data: pwd(30) type c,
key type i value 26101957, "<=== code for FTP
slen type i,
scrambled_pwd(60) type c. "<=== must be double length of PWD
slen = strlen( pwd ).
call function 'HTTP_SCRAMBLE'
exporting
source = pwd
sourcelen = slen
key = key
importing
destination = scrambled_pwd.
2024 Sep 13 8:22 AM
Have a look at SAP note 1605054 (https://me.sap.com/notes/1605054).