Start of Content Area

Background documentation Semantic Attributes of Foreign Keys  Locate the document in its SAP Library structure

A foreign key describes a relationship between two tables. You can define this relationship more precisely by specifying the cardinality and type of foreign key fields.

This information is optional and is primarily for documentary purposes. In particular, the definitions of the cardinality and type of the foreign key fields are not used in the value check for the foreign key.

The definition of the semantic attributes is only used in the following cases:

Example

The foreign key between tables SBOOK and SCOUNTER ensures that only existing counters can be entered in field COUNTER (counter at which the flight was booked). See the example in Foreign Keys .

A booking can be made at either a travel agency or at the carrier’s sales counter. If the booking is made at a travel agency, the field COUNTER of table SBOOK remains empty. The foreign key fields do not have to be filled, that is the left side of the cardinality is C. Any number of bookings may be made at each counter. There may therefore be any number of entries (bookings) in foreign key table SBOOK for each record of the check table SCOUNTER. The right side of the cardinality is therefore CN.

Of course several bookings can be made for the same carrier at a counter. These bookings do not differ in their foreign key fields (MANDT, CARRID, COUNTER). The entries in the foreign key fields therefore do not uniquely identify an entry in the foreign key table SBOOK (a booking). The foreign key fields therefore have the type No key fields/candidates.