The SAP Help states that statements that previously only accessed the primary key have been enhanced so that access to secondary keys is now possible. WITH NON-UNIQUE SORTED KEY sort_key COMPONENTS bismt. The internal table definition could be as shown below. But, on the other hand, secondary keys also incur additional administration costs due to memory consumption and run-time.įor example, lets create a secondary index into the internal table IT_MARA for the column BISMT, this is just like having a secondary Z- index on BISMT in the database table definition. The SAP Help states that using the secondary key could increases read access performance significantly. Well now as of ABAP 7.2 can declare secondary keys for internal tables.
![delete itab from wa delete itab from wa](http://1.bp.blogspot.com/-dGBpglNXU8s/UHRzM41TmfI/AAAAAAAAIXg/eAPnafJkXuc/s1600/Olympic+National+Park+16.jpg)
OK, back to internal tables, traditionally, if you wanted to read an internal table in two different ways (e.g.,looking for a material by Material Number or by Reference Number), then you either had to keep sorting the table just before a read, or have two identical tables sorted differently. Why do we create a custom index or z-index? For performance… we recognize that a table could be queried in more ways then just by the primary key, so we setup customer indexes that we believe will be used by the Database Optimizer when determining the access path and thus make the query performant.
![delete itab from wa delete itab from wa](https://cdn.geekdashboard.com/wp-content/uploads/2017/11/enable-notification-access-permission-768x1195.jpg)
Using Secondary Keys to Access Internal Tables in ABAP 7.4Īll of us who have been developing in ABAP at one time or another have created a custom index on a database table.