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

FTP files

Former Member
0 Likes
794

Hi

File need to fetched from FTP..

What is this exactly means

where exactly the file get stored and how it need to picked when sent by some non-sap

do we have any directory representing as FTP where the file is physically stored and then fetched for processing in abap using idoc

Hi

File need to fetched from FTP..

What is this exactly means

where exactly the file get stored and how it need to picked when sent by some non-sap

do we have any directory representing as FTP where the file is physically stored and then fetched for processing in abap using idoc

5 REPLIES 5
Read only

Former Member
0 Likes
721

Kiran kumar Wrote :

File need to fetched from FTP..

Hi,

Let say for eg : we have SAP System S and Non SAP System NS, which has FTP Server is

192.168.10.10.

So, system NS will Download a File to FTP and system S will Upload everyday. This can be done as follow Simple code:

Hi,

For Example :

data : v_handle TYPE i.

CONSTANTS: cs_key_500098 TYPE i VALUE '500098'.
DATA: it_itab(255) OCCURS 0 WITH HEADER LINE.
DATA: v_password(20) TYPE c,
i_key TYPE i VALUE 500098,
v_pwd_len TYPE i,
DATA: v_key TYPE i.

v_password = 'youreoneh'.
v_pwd_len = STRLEN( v_password ). and a constant key has to be passed.

CALL FUNCTION 'HTTP_SCRAMBLE'
EXPORTING
SOURCE = v_password
sourcelen = v_pwd_len
key = cs_key_500098
IMPORTING
destination = v_password.

Then :

CALL FUNCTION 'FTP_CONNECT'
EXPORTING
user = 'user_name'
password = v_password
host = '192.168.10.10' " for example
rfc_destination = 'SUNRFC' " for example
IMPORTING
handle = v_handle
EXCEPTIONS
not_connected = 1
OTHERS = 2.

Then : CONCATENATE sy-datum SY-TZONE '.txt' INTO v_filename.
CONCATENATE '//192.168.10.10/sap file/' v_filename INTO v_filename .

then use the 
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_filename
write_field_separator = 'X'
TABLES
data_tab = ta_download
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.

Then finally Disconnect the connection:
CALL FUNCTION 'FTP_DISCONNECT'
EXPORTING
handle = v_handle
EXCEPTIONS
OTHERS = 1.

Regards,

Suneel G

Read only

0 Likes
721

hi suneel and avinash

so we can say that it is like a folder on some server...

So this part of code do we need to write in process code assigned either to inbound or outbond settings

Read only

0 Likes
721

Hi,

Yes..that's right.

Are you talking about the IDOC inbound process Code...Then Process code is triggered whenever system receives the IDOC from other server. Then where is the use of FTP.

FTP is used to directly read the data from FTP server. You can refer to the link in my previous post ..and add the code in your program to connect to FTP and upload the data from FTP server to internal table.

Read only

0 Likes
721

hi avinash

i need to process the incoming idocs in sap

but the files from non-sap in stored on FTP server

how exactly these need to be handled

any report with ftp commands is sufficient for this

but i am having standard formats for the ftp files

DIDPP06E and DIDMM02E

But i have to background scheduling also so that the files are picked automatically

Read only

Former Member
0 Likes
721

Hi,

Refer to this link..http://docs.google.com/Doc?docid=dfv2hmgs_20cmdgkx29&hl=en

How fetch the data from the FTP server to internal table.