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

How to delete file on FTP Server using ABAP command?

Former Member
0 Likes
3,644

Dears ,

I have connect FTP server and want to delete one file on FTP server,

But when I use:

data lv_command(50) type c.

lv_command = 'DELETE test.txt'.

CALL FUNCTION 'FTP_COMMAND'

EXPORTING

handle = p_handle

command = lv_command

TABLES

data = lt_ftp_result

EXCEPTIONS

tcpip_error = 1

command_error = 2

data_error = 3

OTHERS = 4.

The sy-subrc = 2, callled 'Invalid Comand'

I also try other command for example:

DELE test.txt

MDELETE test.txt

all the above commands are have a result : Invalid command.

So how can I delete FTP file use ABAP?

Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,894

Could any gurus can help me?

Dears ,

I have connect FTP server and want to delete one file on FTP server,

But when I use:

data lv_command(50) type c.

lv_command = 'DELETE test.txt'.

CALL FUNCTION 'FTP_COMMAND'

EXPORTING

handle = p_handle

command = lv_command

TABLES

data = lt_ftp_result

EXCEPTIONS

tcpip_error = 1

command_error = 2

data_error = 3

OTHERS = 4.

The sy-subrc = 2, callled 'Invalid Comand'

I also try other command for example:

DELE test.txt

MDELETE test.txt

all the above commands are have a result : Invalid command.

So how can I delete FTP file use ABAP?

Thanks

2 REPLIES 2
Read only

Former Member
0 Likes
1,895

Could any gurus can help me?

Read only

0 Likes
1,894

I found this in some of my old code:

*Delete the existing file

CONCATENATE 'del' ftpfile1 INTO delfile1 SEPARATED BY SPACE.

CALL FUNCTION 'FTP_COMMAND'

EXPORTING

handle = hdl

command = delfile1

TABLES

data = result

EXCEPTIONS

command_error = 1

tcpip_error = 2.

*End of deleting the existing file

I think it's just 'del' to delete the file.