SAP NetWeaver AS ABAP Release 752, ©Copyright 2017 SAP AG. All rights reserved.
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 theprimary key of the table.The key fields of a table must be located together at the beginning of the table, which means that nonon-key fields are allowed between two key fields. The primary key comprising the key fields is a uniqueidentification for a table row. If other combinations of table rows identify a table row uniquely, they are called key candidates. Theprimary index is createdfor 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 of the number of bytes in the non-character-likekey fields and the number of characters in the character-like key fields must not exceed 900. If the total 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 predefined data types are not allowedfor key fields: DF16_SCL and DF34_SCL (both obsolete) plus FLTP, STRING, RAWSTRING, LCHAR, and LRAW. A key field with the type RAW must not be longer than 69 bytes.
Notes
- The key fields are restricted in such a way that the requirements of all supported database platformsare 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 Open SQL, a syntax check warning occurs. The warning indicates that a cross-platform replacement implementation must be made. The classCL_ABAP_DBFEATURES can be used to identify which restrictions are supported by the current database system.
- In the case of key fields, the flag for initial values is always set automatically.