Skip to content

ABAP Keyword Documentation →  ABAP - Dictionary →  Classic Objects in ABAP Dictionary →  Database Tables →  Semantic Attributes of Database Tables →  Table-Specific Semantic Attributes of Database Tables 

Key Fields of Database Tables

At least one table field must be flagged as a key field in the structure of a database table. The table fields flagged as the key field become the primary key of the table. The key fields of a table must be located together at the beginning of the table, which means that no non-key fields are allowed between two key fields. The primary key comprising the key fields is a unique identification for a table row. If other combinations of table rows identify a table row uniquely, they are called key candidates. The primary index is created for the primary key of the table. This index provides optimized key access to the table rows when values are specified for the key fields.

There can be a maximum of 16 key fields in each table. The total number of bytes in all key fields on the database cannot exceed 900. If the number is greater than 120, however, the following restrictions apply:

  • Table content cannot be transported by specifying the complete key values. Instead, the generic key values must be specified with a maximum total of 120 bytes or characters.
  • The table cannot be used as the basis table of a lock object.

The following built-in data types are not allowed for key fields: DF16_SCL and DF34_SCL (both obsolete) plus FLTP, STRING, RAWSTRING, LCHR, LRAW, and GEOM_EWKB. A key field with the type RAW must not be longer than 69 bytes.

Other versions: 7.31 | 7.40 | 7.54


  • The key fields are restricted in such a way that the requirements of all supported database platforms are met. At SAP, tables can be flagged to allow these restrictions to be exceeded in the case of features. When tables flagged in this way are accessed using ABAP SQL, a syntax warning from the extended program check occurs. The warning indicates that a cross-platform replacement implementation may be necessary. The class CL_ABAP_DBFEATURES can be used to identify which restrictions are supported by the current database system.

  • No null values can be inserted in key fields. Any attempts to do this raise an exception on the database.