Show TOC

 Semantic Attributes of Foreign KeysLocate this document in the navigation structure

Use

You use foreign keys to describe the relationship between two tables. You can define this relationship more precisely by specifying the cardinality and type of foreign key fields.

The definitions of the cardinality and type of the foreign key fields are not used in the value check for the foreign key.

Features

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

  • If you select Key fields of a text table as the type of the foreign key fields, the foreign key table is considered to be the text table for the check table. If a screen field is checked against a table, the key entries of the check table are displayed in the input help (F4 help) for this field. If there is a text table for the check table, each key entry displayed is enhanced with an explanatory text (contents of the first character-like field of the text table) in the user's logon language.
  • Tables can be included in a help view or maintenance view if they are linked to a foreign key. It only makes sense to create such a help or maintenance view if each record in the primary table of the view has no more than one corresponding record in each secondary table of the view. The system checks if the foreign keys with which the tables are linked in the view have suitable cardinalities when it creates a maintenance or help view. See also Restrictions for Maintenance and Help Views .
Example

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

A booking can be made at a travel agency or at the carrier's sales counter. If the booking is made at a travel agency, the COUNTER field 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 can be made at each counter. There can 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.

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 do not uniquely identify an entry in the foreign key table SBOOK (a booking). The foreign key fields have the type No key fields/candidates.

See also:

Cardinality

Type of Foreign Key Fields