ABAP Keyword Documentation →  ABAP − Reference →  Processing Internal Data →  Internal Tables →  Internal Tables - Overview →  Table Keys →  Secondary Table Key → 

Updating Secondary Keys

For all statements that change the content and structure of an internal table, the internal administration of the secondary keys is updated automatically as follows:

Inserting operations include table statements such as INSERT and APPEND and block operations for which the entire body of the table is filled at once, like for statements between internal tables, passing parameters to procedures, filling internal tables with SELECT, importing with IMPORT, and so on. The operation for deleting table rows is the DELETE table statement.
In both cases, a non-unique key not updated until the secondary table key is next used explicitly (lazy update).

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. These methods can be used for analysis and test purposes. It might also make sense to use them after making changes if the next access does not take place immediately afterwards in order to handle possible exceptions there and then.

Example

The example of Deletion Using Table Keys demonstrates the runtimes that are required to create the secondary key and when they occur.