SAP DDIC DATABASE TABLES KEY



Get Example source ABAP code based on a different SAP table
  



ABAP_DDIC - Key Fields of Database Tables
At least one table field must be flagged as a key field in the structure of a DDIC database table. The table fields flagged as key fields 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 formed by 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.
BEGIN_SECTION VERSION 5 OUT
The table cannot be used as the base table of a lock object.
END_SECTION VERSION 5 OUT
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.



Latest notes:

The flag for initial values is always set automatically for key fields.
No null values can be inserted in key fields. Any attempts to do this raise an exception on the database.
NON_V5_HINTS
The limit in the number of key fields is defined in such a way that the requirements of all supported database platforms are met. Internally at SAP, tables can be flagged to allow these restrictions to be exceeded in extensions. When tables flagged in this way are accessed using AB_SQL , a syntax warning from the extended program check occurs. The warning indicates that a platform-independent replacement implementation may be necessary. The class CL_ABAP_DBFEATURES can be used to identify which limits are supported by the current database system.
ABAP_HINT_END
BEGIN_SECTION SAP_INTERNAL_HINT
The internal SAP flags for larger keys can be seen in columns KEYMAX_FEATURE and KEYLEN_FEATURE of system table DD02L.
END_SECTION SAP_INTERNAL_HINT