report zsplit_command_in_files .
parameters: p_file type localfile default '/usr/sap/TST/SYS/Test.txt'.
data: begin of itab occurs 0,
fielp_file(20) type c,
field2(20) type c,
field3(20) type c,
end of itab.
data: wa type string.
CONSTANTS: con_tab TYPE x VALUE '09'.
* if you have a newer version, then you can use this instead.
* constants:
* con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB.[/b]
start-of-selection.
open dataset p_file for input in text mode encoding default.
if sy-subrc = 0.
do.
read dataset p_file into wa.
if sy-subrc ne 0.
exit.
endif.
* Here you are splitting at the hex value of "tab" not at
* the # sign.
split wa at con_tab into itab-fielp_file itab-field2 itab-field3.
append itab.
enddo.
endif.
close dataset p_file.
No comments:
Post a Comment