How to Check FTP Connection from ABAP?

Explanation of the Question

You have an FTP server that needs to be accessed from an ABAP system, using ABAP. Not only do you need to connect, but you also want to create/view/download something — in other words, perform specific commands.

See: List of FTP commands

If you have all the necessary connection credentials, the initial connection check can be done using any FTP client you prefer. If everything works fine there, you can attempt the connection from within SAP.

Solution

To test the connection to an FTP server from an ABAP system, you need to run the program RSFTP002.

If the connection to the FTP server is successful, you should receive a response similar to the one below:

Note: Before testing the connection, you must add the name of the server you want to connect to in the table SAPFTP_SERVERS.

If the entry is missing from the table, you will receive an error message like the following:

P.S. As additional information: It is also possible to execute the ping command from the SAP system.

See: ping (networking utility)

To run the command, start transaction OS01.

Click the Specific IP Address button and enter the desired address.