REPORT ZRRSAMPLE.
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 c VALUE cl_abap_char_utilities=>horizontal_tab.
* if you have a older version, then you can use this instead.
* CONSTANTS: con_tab TYPE x VALUE '09'.
* and comment this line above: constants:
* con_tab type c value cl_abap_char_utilities=>HORIZONTAL_TAB.
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.
05/08/2010
Split Command in Files
Assinar:
Postar comentários (Atom)
Nenhum comentário:
Postar um comentário