Entering content frame

Background documentation Generic and Constant Foreign Keys Locate the document in its SAP Library structure

It is not always advisable to check a foreign key against all the key fields of the check table. This is true for example for time-dependent check tables and for check tables whose version number is a component of the key.

You can use generic foreign keys in these cases. Fields are excluded from the assignment to the key fields of the check table here. The check is only against the remaining key fields.

You can also assign a constant value to a key field of the check table. In this case you only have to check against the specified constant. You can use this check if only records of the check table which contain a constant value in this key field are valid.

This graphic is explained in the accompanying text

The corresponding SELECT statement for the screen check has the following form for the foreign key definition in the graphic:

SELECT * FROM PTAB WHERE PTAB-FIELD1 = FTAB-FIELD6 AND PTAB-FIELD3 = FTAB-FIELD8 AND PTAB-FIELD4 = ‘K’.

An entry is only valid in check field Field6 if a record of check table PTAB exists containing the input value for Field6 in PTAB-Field1, the input value for Field8 in PTAB-Field3 and constant K in PTAB-Field4.

This graphic is explained in the accompanying text

The values entered on the screen for Field7 and Field9 are meaningless when checking against the check table. An entry with Field6 = 1, Field8 = 3 and Field9 = B would not be valid in this case since there is no record with PTAB-Field1 = 1, PTAB-Field3 = 3 and PTAB-Field4 = K in the check table!

Leaving content frame