2007 Sep 05 4:46 PM
hi all
i want to convert .txt (from applicaiton server) to internal table , im getting the contents in the itab, but im not able to remove '#',
can anybaody help me?
Thanks.
2007 Sep 05 4:49 PM
HI,
data : begin of itab occurs 0,
line(1000),
end of itab.
data : begin of jtab occurs 0,
field1,
fiedl2,
..
end of jtab.
after you read data from applicaton server into itab.
then do this.
loop at itab.
split itab-line at cl_abap_char_utilities=>cr_lf into jtab-field1 jtab-field2.
append jtab.
endloop.l
2007 Sep 05 4:51 PM
The # is a representation of the tab, so you need to do something like this.
report zrich_0001.
data: str type string.
data: begin of itab occurs 0,
fld1(10) type c,
fld2(10) type c,
fld3(10) type c,
end of itab.
data:
dsn(100) value '/usr/sap/TST/sys/test.txt'.
constants:
con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB.
clear itab. refresh itab.
* Read the data.
open dataset dsn for input in binary mode.
do.
read dataset dsn into str.
if sy-subrc = 0.
split str at con_Tab into itab-fld1 itab-fld2 itab-fld3.
append itab.
else.
exit.
endif.
enddo.
close dataset dsn.
Loop at itab.
write:/ itab-fld1, itab-fld2, itab-fld3.
endloop.
Regards,
RIch Heilman