Copyright 2022 - BV TallVision IT

The internal table is an Abap language component that is used very often. Whenever information is needed in repetitive form, the internal table is used. You will not find many reports that have no internal tables, and they have been around since the earliest Abap versions. 


The internal table allows access/processing on data in Abap working memory. It is defined as a variabele with the DATA statement, and there are many internal table specific statements available. Summing up the ways an internal table can be declared:

  • As a single field: DATA: lt_bukrs type table of BUKRS.
  • Containing several fields: DATA: lt_T001W type table of T001W.
  • With a reference to a locally defined type:
    TYPES: begin of ty_mystuff, 
             BUKRS type BUKRS, 
             MYFLAG type C, 
             SOMETEXT type string, 
           end of ty_mystuff. 
    DATA:  ta_mystuff type standard table of ty_mystuff. 
  • Using a table type. Note that table types can also be defined as such in the data dictionary (SE11).
    DATA: ta_mystuff type ty_mystuff.

The use of internal tables has come a long way. In the beginning an internal table always had a header and was declared with an expected growth indication: DATA: TA_BUKRS TYPE BUKRS OCCURS 10.. These definitions are still available, and some developers still implement them. In OO (Object Oriented) Abap coding they are no longer allowed.

Table headings

Internal tables that are defined in the old-fashioned way (using OCCURS) automatically have a table header. Hence the variable consists of 2 parts, TA_BUKRS which is a field that can be used, written or changed and the TA_BUKRS as a table, which can also be read (READ TABLE) or LOOPed over

If you would like to work the same way, having the name of your table available as header line as well as the actual table, you can use the option WITH HEADER LINE in the data declaration. However work areas for an internal table are best defined "on their own". Like so:

  • DATA: ta_mystuff type standard table of ty_mystuff WITH HEADER LINE.
  • Or (better)
    DATA: ta_mystuff type standard table of ty_mystuff,
              wa_mystuff type ty_mystuff.

Clear the table with CLEAR like so: CLEAR ta_mystuff[]. and clear the table header like so: CLEAR ta_mystuff.. Note that the REFRESH ta_tab. statement is the same as CLEAR ta_tab[]. (and thus obsolete).

So what about these table headings ? They are effectively the work-area for table manipulation statements. So it is not possible to change a field on line 2 of your table like so:

 TA_MYSTUFF[2]-MYFLAG = 'X'. "Not possible

Instead you have to read line 2 into a work area, change the field on the work area and place the changed line back into the table. Such is (Abap) life.