Ansicht
Dokumentation

ABENITAB_KIND - ITAB KIND

ABENITAB_KIND - ITAB KIND

ABAP Short Reference   Addresses (Business Address Services)  
This documentation is copyright by SAP AG.
SAP E-Book

- Selection of the Table Category

What kind of table should be used in an individual case depends on the type of individual line access that will be used most often on the table. These rules are made suitably relative to tables with secondary keys.

  • Standard Tables
    This category of table is appropriate when the individual entries can be addressed using the index. Access using the index is the fastest possible access to table entries. Standard tables should be filled by appending lines using APPEND and implement the other accesses using an index specification (INDEX addition of the respective statements). Since the cost of accesses to standard tables using the primary key increases linearly with the number of table entries, this type of access should only be used on standard tables if the filling of the table can be separated from the rest of the processing. If a standard table is sorted after filling, the cost of a key access with a binary search (BINARY SEARCH) has a logarithmic relationship to the number of table entries.
  • Sorted Tables
    This kind of table is appropriate if the table must be sorted from the time of creation. The filling of the table takes place by insertion using the INSERT statement and in accordance with the sort order defined by the primary table key. The cost of key accesses is related logarithmically to the number of table entries because a binary search is automatically carried out. Sorted tables are also particularly suited for partially sequential access in a LOOP loop, if the first part of the table key is specified in the WHERE condition.
  • Hashed Tables
    This kind of table is suitable when key accesses are the central operation to be carried out on the table. Hashed tables cannot be accessed using a primary table index. However, the cost per key access is always constant and independent of the number of table entries. As with database tables, the key of hashed tables is always unique. Therefore hashed tables are suitable for creating internal tables that are similar to databases and can be used in a corresponding fashion.

Example

A table scarr_tab_down intended for index access should be sorted by key field in descending order. This can only be a standard table. If a table in ascending order is required, a sorted table can (and should) be used, in this case scarr_tab_up. If only key access is required, then a hashed table like scarr_tab_key can be used.






CPI1466 during Backup   SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up  
This documentation is copyright by SAP AG.

Length: 3156 Date: 20240425 Time: 110822     sap01-206 ( 77 ms )