Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Read data to internal table

Former Member
0 Likes
333

I will use READ DATASET to read the file content, the content will be tab spearated, I would like to know how to read each field to interal table. Thanks!

1 REPLY 1
Read only

venkat_o
Active Contributor
0 Likes
303

Hi,

<li>Define horizontal tab.


DATA: hor_tab TYPE c VALUE cl_abap_char_utilities=>horizontal_tab.

<li>Try like below for every record in the file.


OPEN DATASET ....
DO.
  READ DATASET file INTO wa_content.
  IF sy-subrc EQ 0.
    SPLIT wa_content AT hor_tab INTO wa_data-field_01
                                     wa_data-field_02
                                     wa_data-field_03
                                     wa_data-field_04.
    APPEND wa_data TO it_data.
    CLEAR  wa_data.
  ELSE.
    EXIT.
  ENDIF.
ENDDO.
CLOSE DATASET...

Regards,

Venkat.O