cancel
Showing results for 
Search instead for 
Did you mean: 

Getting the contents of a file...

Former Member
0 Kudos

Hi All,

I have to process a file which is residing in the ftp server.

Is there any way of processing the data of the file without the need to write to my application server?

Regards,

Rajasekhar dinavahi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

see below link

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

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

You can do so.

CONSTANTS: c_dest TYPE rfcdes-rfcdest VALUE 'SAPFTP',

c_key TYPE i VALUE 26101957.

l_slen = STRLEN( p_pwd ).

CALL FUNCTION 'HTTP_SCRAMBLE'

EXPORTING

SOURCE = p_pwd

sourcelen = l_slen

key = c_key

IMPORTING

destination = p_pwd.

CALL FUNCTION 'FTP_CONNECT'

EXPORTING

user = p_user

password = p_pwd

host = p_host

rfc_destination = c_dest

IMPORTING

handle = l_hdl

EXCEPTIONS

OTHERS = 1.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

        • DERIVE ALL THE FILES IN '/PUB/INBOX' FOLDER.

CALL FUNCTION 'FTP_COMMAND'

EXPORTING

handle = l_hdl

command = l_cmd

TABLES

data = l_result

EXCEPTIONS

tcpip_error = 1

command_error = 2

data_error = 3

OTHERS = 4.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

You need to have FTP server user id and password.

thanks

sharmistha

Message was edited by: Sharmistha Parida