Application Development 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: 

FTP in append mode (FTP_R3_TO_SERVER)

Former Member
0 Kudos

Do you know anyway to execute an FTP append command from ABAP?

I like FTP_R3_TO_SERVER but it just perform FTP put command (each time target file is replaced).

Sergio

1 ACCEPTED SOLUTION

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

The FTP_R3_TO_SERVER is nice because it takes data directly from memory and performs an FTP on it. However it is a little limited in options as you found.

If you don't mind writting your file to your local filesystem first, you can always use the function modules FTP_CONNECT, FTP_COMMAND, and FTP_DISCONNECT. You can string together muliptle calls to FTP_COMMAND to issue all sorts of things. You can use puts, appends, or just about anything you can execute from a FTP command line interface.

10 REPLIES 10

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

The FTP_R3_TO_SERVER is nice because it takes data directly from memory and performs an FTP on it. However it is a little limited in options as you found.

If you don't mind writting your file to your local filesystem first, you can always use the function modules FTP_CONNECT, FTP_COMMAND, and FTP_DISCONNECT. You can string together muliptle calls to FTP_COMMAND to issue all sorts of things. You can use puts, appends, or just about anything you can execute from a FTP command line interface.

Former Member
0 Kudos

I failed to use FTP_R3_TO_SERVER to transfer data in memory to file in FTP server. My coding is below,

CALL FUNCTION 'FTP_R3_TO_SERVER'

EXPORTING

handle = mi_handle

fname = 'test.txt'

blob_length = 5000

tables

blob = i_tab

The error msg is 'FTP subcommand:local error'. And then the file TEST.TXT is generated in FTP server,but without any data.

Before call this FM I use FTP_CONNECT to access FTP successfully.

I am wondering whether the data in internal table I_TAB should in Binary code or others?

I checked the program RSFTP007 and it seems the data in file is converted like '61666A6C616A666C616A6A66647061757064666A61643B6B663B616B6B6B6B6B6B6B6B6B6B<'.

I guess I should conver the data before transfer.But I don't know how to do.

Former Member
0 Kudos

Hi, Thomas Jung

Can I ask you a question?

About the FTP_COMMAND, what kind of FTP command it use?

The FTP client command like 'append' 'delete'?(which is also using in console)

or the raw FTP command like 'APPE' 'DELE'?(which is in FTP protocol)

hope your reply, thanks a lot

0 Kudos

Gu,

Could you tell me what is the difference between FTP client command and raw FTP command on 'put'?

0 Kudos

Hi,

These are commands that are supported by FTP_COMMAND.

You can find this list by executing 'help' command using FTP_COMMAND.

! append ascii binary case

cd cdup chmod delete debug

dir get glob help idle

lcd ls mdelete mget mkdir

modtime mput nlist prompt set

put pwd quote rstatus rhelp

rename rmdir site size status

struct system umask

Former Member
0 Kudos

Thanks

Then it looks like FTP_COMMAND support the ftp client command.

To Li: the raw ftp commmand is something belong to FTP protocol. They are the packages content send to ftp sever.

Oppositely, client command is the command you type in the console.

E.G. the append command is APPE for raw, and APPEND for client command.

Former Member
0 Kudos

By the way, in raw command, there is no 'put' command.

If you interesting in raw command, go this link

http://www.faqs.org/rfcs/rfc959.html

thanks

0 Kudos

Thanks,gu.

Now the answer to my question on FTP_R3_TO_SERVER is still in vain...

0 Kudos

i have problem in FTP_R3_TO_SERVER. everything is ok, but created file different from ws_download.i want to publish a text file with 50 rows that created from an internal table. but the generated file has only one row.

here is my code:

in ws_download everything ok.

CALL FUNCTION 'WS_DOWNLOAD'

EXPORTING

filename = 'C:myfile.txt'

filetype = 'DAT'

TABLES

data_tab = formated_output.

*but here all internal table data in one row

DESCRIBE TABLE formated_output LINES tab_lines.

ftp_filename = 'myfile.txt'.

blob_size = tab_lines * 387.

*387:one row lenght

CALL FUNCTION 'FTP_R3_TO_SERVER'

EXPORTING

handle = mi_handle

fname = ftp_filename

blob_length = blob_size

TABLES

blob = formated_output

  • EXCEPTIONS

  • TCPIP_ERROR = 1

  • COMMAND_ERROR = 2

  • DATA_ERROR = 3

  • OTHERS = 4

.

Former Member
0 Kudos

If you want to transfer text rather than binary, please ensure to set export parameter to X and use table entry TEXT rather than BLOB, e.g. like this :

CALL FUNCTION 'FTP_R3_TO_SERVER'

EXPORTING

handle = handle

fname = lf_fname

character_mode = 'X' " !!!!

TABLES

text = chardata " !!!!

EXCEPTIONS

tcpip_error = 1

command_error = 2

data_error = 3

OTHERS = 4.