Tuesday, December 20, 2011

Abap how to read a comma delimited data into internal table


COMMA DELIMITED file to INTERNAL TABLE


don't know about gui_upload, the way we do it is:

declare an internal table like:
data: begin of i_rec occurs 0,
filler(200),
end of i_rec.
data: begin of itab occurs 0,
field1,
field2,
...
end of itab.
Itab is the table you want to fill, i_rec is just a temporary intermediary table.

data: sep_field(1) value ','.
that's your separator (comma or something else).

First call the function GUI_UPLOAD and fill table i_rec with the data in your file.
then:

loop at i_rec.
split i_rec-filler at sep_field into itab-field1 itab-field2 ...
append itab.
clear itab.
endloop.

this should do the trick for as far as I know.


good luck,

ioana

source
http://sap.ittoolbox.com/groups/technical-functional/sap-dev/comma-delimited-file-to-internal-table-151418

No comments:

Post a Comment