Disabling Foreign Key Checks

Use

This topic discusses approaches for disabling foreign key checks in your infotype.

Procedure

If you wished to remove all foreign key checks simultaneously, you could theoretically redefine method CHECK_FOREIGN_KEYS with an empty implementation. In practice, however, only some foreign checks require exclusion. Redefining method FOREIGN_KEY_EXCLUDED_FIELDS , which is designed to return the names of the fields that are to be excluded from foreign key checks, is thus the most efficient manner of disabling, when needed, a subset of foreign checks.

Example Example

Suppose you wish to exclude fields P0002-BEGDA and P0106-ENDDA from foreign key checks for the Family Member/Dependents infotype (0021). Also, suppose PERNR is to be excluded from both records. Under these circumstances, you could insert the following source code in method FOREIGN_KEY_EXCLUDED_FIELDS .

IF PRIMARY_FIELDS = TRUE. APPEND 'BEGDA' TO EXCLUDED_FIELDS. ELSE. APPEND 'ENDDA' TO EXCLUDED_FIELDS. ENDIF. APPEND 'PERNR' TO EXCLUDED_FIELDS.

End of the example.