Get Example source ABAP code based on a different SAP table
ABAP_ITAB - Table Type A table type> defined as a DDIC table type> or using TYPES>> or DATA>> is specified completely using the following technical type properties>:
Line type> The line type> of an internal table can be any data type. If the line type is structured, the individual components of a line are also referred to as the columns of the internal table.
Table category> The table category> defines how an internal table is administered and how its individual lines can be accessed. There are three table categories:
Standard tables> are administered internally using a primary table index>, which can be implemented using a logical index if necessary. The table can be accessed using either a table index or a table key>. The primary key of a standard table is always non-unique. The response time for accessing the table using the primary key depends linearly on the number of entries in the table. Secondary table keys> can be defined to make key access to standard tables more efficient.
Sorted tables> are also administered internally using a primary table index>. They are always sorted according to the primary table key>. Sorting is in ascending order by size according to the comparison rules> for the data types of the key fields and returns the same result as the SORT>> statement without specifying additions. The table can be accessed using either a table index or a table key>. The primary key of a sorted table can be either unique or non-unique. The response time for accessing the table using the primary key depends logarithmically on the number of table entries, since a binary search is used.
Hashed tables> are administered internally using a hash algorithm>. Hashed tables can be accessed using a table key> or a secondary table index >. The primary key of hashed tables is always unique. The response time for primary key access is constant and independent of the number of entries in the table.
Table key> A table key> is used to identify lines in a table (see below). There are two possible key types for internal tables: primary keys> and optional secondary keys>. Every internal table has a primary key, which is either the standard key> or a user-defined key. Depending on the table category, the primary key can be defined as unique or non-unique. A secondary key is either a sorted key, which can be unique or non-unique, or a unique hash key. If keys are unique, a line with a specific content in the key fields > can exist only once in the internal table. A table key can consist of components of the line type or of the entire line ( pseudo component> table_line>) if they are not internal tables or do not contain internal tables. When a table key is defined, the order of the key fields is significant. Unlike all other user-defined data types, a table type defined in the ABAP Dictionary or using TYPES>> does not have to be specified completely. Either only the keys or the line type and the keys can remain unspecified. This makes the type generic and it can be used only for typings> of field symbols and formal parameters. The predefined generic ABAP types> ANY TABLE> and • TABLE> can be used for this purpose. The first type includes all table categories and the second type includes standard tables and sorted tables, known as index tables>. Like strings>, internal tables are dynamic data objects>. Their line type, table category, and table key are always specified completely, but the number of lines is variable and restricted only by the capacity restrictions of specific system installations (see Maximum Size of Dynamic Data Objects>). An additional type property that is not one of the technical type properties> and thus is ignored by the compatibility checks> is the initial memory requirement>. When defining a table type, the addition INITIAL SIZE>> can be used to affect the initial memory requirement.
Latest notes: Table keys are evaluated when typing> is checked. Only actual parameters that have the same keys can be assigned to a formal parameter or a field symbol whose table type has a non-generic primary key or one or more secondary keys. NON_V5_HINTS ABAP_HINT_END
ABAP_EXAMPLE_VX5 Definition of a table type spfli_tab> with the structured line type SPFLI>> from the ABAP Dictionary, the table category hashed table, a unique primary key, and exactly one non-unique sorted secondary key cities>. ABEXA 01057 ABAP_EXAMPLE_END