ABAP - Keyword Documentation →  ABAP - ABAP Release News →  News for ABAP Release 7.0 and its EhPs →  News for ABAP Release 7.0, EhP2 → 
Mail Feedback

Internal Tables in ABAP Release 7.0, EhP2


1. Dynamic WHERE Condition

2. Definition of Secondary Table Keys

3. Using Secondary Keys

4. Updating Secondary Keys

5. Streaming for Internal Tables



Modification 1  

Dynamic WHERE Condition

From ABAP release 7.0, EhP2, the statements LOOP AT itab, MODIFY itab, and DELETE itab make it possible to specify the WHERE condition in a cond_syntax data object dynamically.



Modification 2  

Definition of Secondary Table Keys

Previously, each internal table had just one table key. Any search key could be entered when accessing internal tables, but this was not very efficient. Also, standard tables were always searched linearly during key access. To be able to efficiently access an internal table with different keys, and to also allow efficient key access to standard tables, secondary table keys were introduced.

From ABAP release 7.0, EhP2, secondary table keys can be defined for internal tables with TYPES and DATA as well as in ABAP Dictionary. An internal table can have up to 15 secondary table keys with different names. At the same time, what was previously the table key became the primary table key, and a predefined name for it, primary_key, was introduced. This can be replaced with an alias name in the enhanced definition of the primary table key in ABAP release 7.0, EhP2.

Secondary table keys can be hash keys or sorted keys. A secondary table index is created for each sorted secondary key of an internal table. The previous table index, which exists only for index tables, becomes the primary table index.

Secondary table keys are part of the technical type properties of an internal table. Secondary keys can be specified generically for standalone table types.



Modification 3  

Using Secondary Keys

The following additions have been introduced for statements that access lines of internal tables:

keyname can be used to specify the name of the key to be used statically or dynamically.

At the same time, statements that previously only accessed the primary key have been enhanced so that access to secondary keys is also possible. The table index used can now also be specified explicitly using a table key when indexes are specified. The system field sy-tabix is now filled with reference to the table index used. It is set to 0 for access using a hash key.

The enhanced statements are:

In statements where these additions have not been introduced, such as SORT, COLLECT, or PROVIDE, secondary keys are not explicitly supported.



Modification 4  

Updating Secondary Keys

In all statements that change the content or structure of an internal table, the internal administration of the secondary table key (hash administration or secondary table index) is updated automatically as follows:

Class CL_ABAP_ITAB_UTILITIES contains methods that can be used to update single secondary keys or all secondary keys for an internal table in exceptional situations.



Modification 5  

Streaming for Internal Tables

The new streaming concept supports internal tables.