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: 

Problem with GET File using FTP_COMMAND

yonatanedgardo_diaz
Participant
0 Kudos

Hi,

I have the follow situation:

concatenate 'cd' '/interfaz/DM/data_in/comm' into w_cmd separated by ' '.

call function 'FTP_COMMAND'

EXPORTING

handle = L_HANDLE

command = w_cmd

TABLES

data = result.

w_cmd = 'nlist'.

call function 'FTP_COMMAND'

EXPORTING

handle = L_HANDLE

command = w_cmd

TABLES

data = result.

**.. Create ftp-command

CONCATENATE 'get' '"SM201002230002.txt"'

INTO w_cmd SEPARATED BY ' '.

call function 'FTP_COMMAND'

EXPORTING

handle = L_HANDLE

command = w_cmd

TABLES

data = result.

call function 'FTP_DISCONNECT'

EXPORTING

handle = L_HANDLE.

But I don´t have to take the file.

The result that i have in internal table result is:

nlist

200 PORT command successful.

150 Opening data connection for ..

.sh_history

SM201002230002.txt

SM201002230001.txt

226 Transfer complete.

get "SM201002230002.txt"

200 PORT command successful.

150 Opening data connection for SM201002230002.txt (152 bytes).

226 Transfer complete.

152 bytes received in 0.00 seconds (0.15 Kbytes/s)

Why i Can´t take the File?

2 REPLIES 2

yonatanedgardo_diaz
Participant
0 Kudos

Send the solution.

CONCATENATE 'cd' '/interfaz/DM/data_in/comm' into w_cmd separated by ' '.

CALL FUNCTION 'FTP_COMMAND'

EXPORTING

handle = L_HANDLE

command = w_cmd

TABLES

data = result.

w_cmd = 'ls'.

CALL FUNCTION 'FTP_COMMAND'

EXPORTING

handle = L_HANDLE

command = w_cmd

TABLES

data = result.

TYPES: BEGIN OF ty_files,

file TYPE char200,

END OF ty_files.

DATA: it_files TYPE STANDARD TABLE OF ty_files,

wa_files TYPE ty_files.

LOOP AT result.

check result-line+72(4) = '.txt'.

IF sy-subrc = 0.

W_CMD = result-LINE+58(18).

CALL FUNCTION 'FTP_SERVER_TO_R3'

EXPORTING

HANDLE = L_HANDLE

FNAME = W_CMD " SM201002230001.txt

CHARACTER_MODE = 'X'

  • IMPORTING

  • BLOB_LENGTH =

TABLES

  • BLOB =

TEXT = I_FTP

EXCEPTIONS

TCPIP_ERROR = 1

COMMAND_ERROR = 2

DATA_ERROR = 3

OTHERS = 4.

ENDIF.

ENDLOOP.

0 Kudos

Thanks for your help.