Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Get files from FTP folder

Former Member
0 Likes
1,730

Hi All,

I have following requirement regarding FTP.

My program will run in background & search file(s) in FTP folder which is on FTP server. I have check SAP forum & web blogs but not getting how to achieve this.

Kindly suggest if any solution on this.

Regards,

Dilip

5 REPLIES 5
Read only

Former Member
0 Likes
871

1. Create a UNIX script that executes an FTP to the remote server and performs a directory listing.

2. Create external command using SM69

3. Call external command in program via function SXPG_COMMAND_EXECUTE

This will return your program with a list of files on the remote system. Use similar technique to retrieve specific files as needed.

Read only

0 Likes
871

Hi Michel,

Thanks for your quick reply. Is there any function module to reach the FTP folder on FTP server?

I don't under your 1st point, can you please explain in brief.

<b>1. Create a UNIX script that executes an FTP to the remote server and performs a directory listing.</b>

Regards,

Dilip

Message was edited by: Diliip Gupchup

Read only

0 Likes
871

If you want a function module look at functions that begin with 'FTP'. There are functions for connect, disconnect, command, etc. I've always written scripts for this purpose, but the functions seem to be pretty self-explanatory.

If you would like more info on scripting, let me know. Are you running on UNIX?

When you initially connect using FTP_CONNECT you will receive a HANDLE. Use this HANDLE when calling follow-on functions like FTP_COMMAND.

Read only

0 Likes
871

Hi Michel,

For FTP_CONNECT ZI have to pass Uname, PWD,

Host & RFC destination. I want to know what is meant by Host and how to create RFC destination for FTP folder?

Yes definately I want to knmow more on scripting as I am going to use FTP_CONNECT, FTP_COMMAND & FTP_DISCONNECT.

Regards,

Dilip

Read only

0 Likes
871

In my case, scripting is an alternative to the SAP functions. There is a really good weblog on these functions at:

/people/thomas.jung3/blog/2004/11/15/performing-ftp-commands-from-abap

It refers to a sample SAP program called RSFTP002 that will provide the necessary code for using the functions. It also refers to program RSFTP005 to generate the RFC destination.

I'll try to find a sample UNIX FTP script so you have an alternative.