![](/service/media/topic/eefe0ef7-411b-4889-b06f-a8959ad3d58f/S4D400_24_en-US_media/S4D400_24_en-US_images/01-PropertiesOfComplexITABs_001.png)
The internal tables we have used so far had a scalar data type as their row type. In the example shown in the figures here, the row type of internal table numbers is the ABAP built-in type I.
We refer to these kinds of internal tables as simple internal tables.
![](/service/media/topic/eefe0ef7-411b-4889-b06f-a8959ad3d58f/S4D400_24_en-US_media/S4D400_24_en-US_images/01-PropertiesOfComplexITABs_002.png)
We speak of a complex internal table if the row type is a structured data type.
While a simple internal table has only one nameless column, a complex internal table consists of several columns, each of them with the name and type of the corresponding component of the structured row type. In the example, the row type of internal table connection is a structured type with five components: carrier_id, connection_id, airport_from_id, airport_to_id, and carrier_name. Consequently, internal table connections has five columns with those names.
Note
The columns in the examples in the figures, Reminder: Simple Internal Tables and Internal Tables with Structured Row Type, all have scalar types. More generally, a column of an internal table could also be of structured type or even have a table type. In the latter case, we talk of a nested internal table.![](/service/media/topic/eefe0ef7-411b-4889-b06f-a8959ad3d58f/S4D400_24_en-US_media/S4D400_24_en-US_images/01-PropertiesOfComplexITABs_003.png)
Up to now, we have addressed the rows of an internal table by their position. This is called an index access.
With the named columns of a complex internal table, key access becomes more important. Key access means addressing a row of the internal table by looking for particular values in particular columns. The columns in which you search can be any columns of the internal table.
Index access to an internal table is always very fast, even if the internal table contains many rows. Key access, however, can become very slow if the table contains a lot of rows. Choosing the right access type for the internal table can improve the performance of a key access.
![](/service/media/topic/eefe0ef7-411b-4889-b06f-a8959ad3d58f/S4D400_24_en-US_media/S4D400_24_en-US_images/01-PropertiesOfComplexITABs_004.png)
Every internal table has one of three access types. The access type determines how data is stored in the table and, based on that, how the system reads the table to retrieve the data.
The different types of tables are as follows:
- Standard Table
- In a standard table, the contents are not stored in a particular sort order. By default, new records are appended to the end of the table. In order to retrieve data by key, the system must read it sequentially, which can lead to long retrieval times if the table is very large. The simple internal tables we used so far were standard tables.
- Sorted Table
- In a sorted table, the contents of the table are always sorted according to the key fields in ascending order. When you insert a new record into the table, the system ensures that it is placed at the correct position. Since the data is always sorted, the system can retrieve records more efficiently than from a standard table (as long as you follow particular rules).
- Hashed Table
- Hashed tables are managed using a special hash algorithm. This ensures that the system can retrieve records very quickly even if the table is extremely large. However, this performance gain only works in very particular cases.
![](/service/media/topic/eefe0ef7-411b-4889-b06f-a8959ad3d58f/S4D400_24_en-US_media/S4D400_24_en-US_images/01-PropertiesOfComplexITABs_005.png)
Every internal table has a key. In standard tables, the key does not play a particularly significant role. For sorted and hashed tables, the key is very important as it determines the way in which the data will be managed in the table. Crucially, sorted and hashed tables are only faster for key access that addresses all or at least a subset of the key fields.
A further attribute of the table key is its uniqueness. You will sometimes want to allow duplicate entries in an internal table, and sometimes you will want to ensure that the key is unique. Here, the following rules apply:
- Duplicates are always allowed in standard tables
- Duplicates are never allowed in hashed tables
- For a sorted table, you choose in the definition whether the key is to be unique or non-unique.
Note
Internal tables may also have secondary keys. Secondary keys are a way of improving the performance of key accesses to internal tables that use different combinations of fields. You will find more information about secondary keys in the ABAP syntax documentation.