ABAP Keyword Documentation → ABAP Dictionary → Classic Objects in ABAP Dictionary → Database Tables → Semantic Attributes of Database Tables → Table-Specific Semantic Attributes of Database Tables → Foreign Key Dependencies
Foreign Key
A foreign key consists of one or more foreign key fields of a foreign key table that is itself the primary key of a check table. A database table can have more than one foreign key. A foreign key dependency joins a foreign key table and its check tables. A foreign key table usually only contains entries where the content of the foreign key also occurs precisely once as content of the primary key in the check table. This must also be respected in writes performed using Open SQL.
Foreign keys can have the following attributes:
- Input check
- Generic foreign key fields
- Constant values
- Inheritance
- Cardinality
- 1
Precisely one assigned row of the check table must exist for each record of the foreign key table.
- C
No assigned rows must exist in the check table for a record of the foreign key table.
- 1
Precisely one assigned row in the foreign key table must exist for each row of the check table.
- C
There can be no more than one assigned row in the foreign key table for each row of the check table.
- N
There must be at least one assigned row in the foreign key table for each row of the check table.
- CN
There can be any number of assigned rows in the foreign key table for each row of the check table.
- Type of the foreign key fields
- No key fields/key candidates
The foreign key fields are not primary key fields of the foreign key table and do not identify a record of the foreign key table uniquely.
- Key fields/key candidates
The foreign key fields are either primary key fields of the foreign key table and or they identify a record of the foreign key table uniquely as a key candidate.
- Key fields of a text table
If this type of foreign key fields is defined, the foreign key table is handled as a text table of the check table. The primary key of the foreign key table must match the check table, plus a language key field with the type LANG. There can be only one text table for each check table (otherwise an activation warning occurs). The texts in a text table are used, for example, to explain input helps on dynpros and Web Dynpros.
Other versions:
7.31 | 7.40 | 7.54