11-10-2009 5:35 PM
Hello all,
I am able to get data from FTP server file into internal table. But when I look at it_dat data, some data is truncated.
For example if actual data in file is :-
*266 15 12 1718 1717 dgcyau dwcwc 1828 273883 shcd 182823 wedc 1829 dwed 19wu9 dewd *
then the retrieved data in it_dat is :-
266#15#12#1718#1717#dgcyau#dwcwc#1828#273883#shcd# 82823#wedc#1829#dwed#19wu9#dewd#################################################.
As you can see '1' is missing in 182823.
The code is as below:-
clear it_dat.
**get remote file
CALL FUNCTION 'FTP_SERVER_TO_R3'
EXPORTING
HANDLE = w_hdl
FNAME = 'outbound.xls'
CHARACTER_MODE = 'X'
IMPORTING
BLOB_LENGTH =
TABLES
BLOB =
TEXT = it_dat
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.
Any help would be appreciated.
Thanks,
Sandesh
11-10-2009 5:46 PM
11-10-2009 6:08 PM
TYPES : BEGIN OF st_cus,
ledgerkey(50) TYPE c, "LedgerKey
wrk_delim1 TYPE x ,
name1(80) TYPE c, "AccountName
wrk_delim2 TYPE x ,
kunnr(50) TYPE c, "AccountReference
wrk_delim3 TYPE x ,
name2(80) TYPE c, "Address1
wrk_delim4 TYPE x ,
stras(80) TYPE c, " Address2
wrk_delim5 TYPE x ,
ort01(50) TYPE c, " Town
wrk_delim6 TYPE x ,
regio(50) TYPE c, " County / State
wrk_delim7 TYPE x ,
pstlz(10) TYPE c, "Post Code / ZIP
wrk_delim8 TYPE x ,
land1(2) TYPE c, "Country
wrk_delim9 TYPE x ,
waers(3) TYPE c, "AccountCurrencyCode
wrk_delim10 TYPE x ,
telf1(20) TYPE c, "ContactTelephone
END OF st_cus .
DATA: it_dat TYPE STANDARD TABLE OF st_cus,
wa_dat LIKE LINE OF it_dat.
11-10-2009 6:29 PM
I see that in my system that function is usually used with tables with a single field.
Maybe your problem has to do that you are not giving space after the telephone to locate the line feed. Try to place a 2 position type x and see what happens.
Or better, use a type with enough space like
TYPES : BEGIN OF st_cus,
line(300),
END OF st_cus .
and check if that helps, then split the fields latter
11-10-2009 6:32 PM