What does it do? Defines a secondary table key of an internal table. The syntax and semantics of the additions are the same as those for the TYPES statement for standalone table types.
ABAP_PGL Use secondary keys in a way that benefits the table.
Latest notes:When internal tables are accessed with the statements READ TABLE itab, LOOP AT itab, MODIFY itab, and DELETE itab or using table expressions, a secondary key can be used to determine the rows to be processed or the processing order. To do this, the additions WITH [TABLE] KEY ... COMPONENTS or USING KEY must be specified in the statements and KEY in table expressions. A secondary key is never used implicitly. The INSERT itab statement determines the insert position using the primary key and primary index only. A secondary key can be specified only for the source table from which multiple rows are copied. The latter also applies to the APPEND statement. If a secondary key is defined, the addition WITH HEADER LINE can no longer be specified, even outside classes. For more information, see TYPES .
Example ABAP Coding The DEMO_SECONDARY_KEYS program demonstrates the declaration and use of a secondary table key and the resulting performance gains.