
When you define the table, you must specify whether the key is to be unique or not. The key of a sorted table can be either unique or non-unique. The response time for key access is logarithmically proportional to the number of table entries, since the system uses a binary search. The system can access records either by using the table index or the key. Sorted tables are always saved sorted by the key. This means that standard tables can always be filled very quickly, since the system does not have to check whether there are already existing entries. The key of a standard table is always non-unique. The response time for key access is proportional to the number of entries in the table.

In this case, the index administration overhead increases in logarithmic and not linear relation to the number of lines. From a particular size upwards, the indexes of internal tables are administered as trees. Internal tables can be divided into three types: Standard tables have an internal linear index. The table type determines how ABAP will access individual table entries. You should remember this, for example, if you intend to sort the table according to the key. When you define the key, the sequence of the key fields is significant.

Internal tables with a user-defined key are called key tables. The user-defined key can contain any columns of the internal table that are not references or themselves internal tables.

The default key of an internal table whose line type is an internal table, the default key is empty. If a table has an elementary line type, the default key is the entire line. If a table has a structured line type, its default key consists of all of its non-numerical columns that are not references or themselves internal tables. The uniqueness depends on the table access method. Internal tables with a unique key cannot contain duplicate entries. You can specify whether the key should be UNIQUE or NON-UNIQUE. There are two kinds of key for internal tables - the standard key and a user-defined key. However, the line type may also be elementary or another internal table. Each component of the structure is a column in the internal table. The data type of an internal table is normally a structure. The line type of an internal table can be any data type. The data type of an internal table is fully specified by its line type, key, and table type. Internal tables and structures are the two structured data types in ABAP. The data type is also an attribute of an existing data object. A data type is the abstract description of an internal table, either in a program or centrally in the ABAP Dictionary, that you use to create a concrete data object. Like all elements in the ABAP type concept, internal tables can exist both as data types and as data objects. They are also a good way of including very complicated data structures in an ABAP program. A particularly important use for internal tables is for storing and formatting data from a database table within a program. You should use internal tables whenever you want to process a dataset with a fixed structure within a program. Since they are dynamic data objects, they save the programmer the task of dynamic memory management in his or her programs. In ABAP, internal tables fulfill the function of arrays. The data is stored line by line in memory, and each line has the same structure. Internal tables provide a means of taking data from a fixed structure and storing it in working memory in ABAP. The data type of individual rows can be either elementary or structured.

The header line is similar to a structure and serves as the work area of the internal table. It can contain any number of identically structured rows, with or without a header line. Data structure that exists only at program runtime.Īn internal table is one of two structured data types in ABAP.
