Functionality The ABAP Dictionary function module DDUT_FORKEY_CHECK checks the dataof a table for consistency of its foreign key definitions. The function module simulates the foreign key checks that are normallyperformed in the screens by DYNP. Entries: TABNAME : Name of the foreign key table FIELDNAME : Name of the check field Optional. If no field name is given, all the foreign keys of TABNAME are checked VALUE_LIST : Value list: the values of fields of the foreign key table. The value list must have the structure of the foreign key table (supplement for cross-structure foreign keys, see ADAPTED_FIELDVALUES parameter) CLIENT_SPECIFIED : Flag if client is specified (otherwise the system client is used as the value of the client field, as for DYNP) ADAPTED_FIELDS : Obsolete. From Release 5.0 replaced byADAPTED_FIELDVALUES For exceptions of cross-structure foreign key definitions, i.e. if not all the foreign key fields are from the foreign key table. The table name, field name and possibly data type and length of the field of cross-structure foreign keys that do not belong to the foreign key table are entered in ADAPTED_FIELDS. The data type/length is only required if the foreign key field does not belong to a DD table/structure, but originates from an ABAP work area (CHAR is assumed if only the length but not the data type is specified). The corresponding values must be added to VALUE_LIST in the order and formats defined in ADAPTED_FIELDS. ADAPTED_FIELDVALUES: Pass by value for exceptions of cross-structure foreign key definition, that is, if not all foreign key fields are from the foreign key table. The table name, field name, and reference to the field of cross-structure foreign keys that do not belong to the foreign key table are entered in ADAPTED_FIELDVALUES. ACCEPT_INITIAL : Flag if initial values should be accepted. If ACCEPT_INITIAL = 'X': If foreign keys are assigned initial values, e.g. CHAR fields with SPACE, no error is delivered even if the corresponding entries are not in the check table. This corresponds to the behavior of the foreign key check on the screen. The default value for ACCEPT_INITIAL, hoever, is SPACE, i.e. initial values are checked. Output: COND_TAB Lines of the WHERE conditions (with check field and check table) FAILURE_TAB Output of the fields for which the foreign key checks were negative, including the messages output by DYNP. The messages are entered in the ABAP Dictionary in the foreign key definition. Message 00 058 is output by default. If table FAILURE_TAB is not specified in the module call, only the COND_TAB is filled, but no checks are made. Example Example for call: ..... DATA: FKTAB TYPE FKTAB. TABNAME: LIKE DD02L-TABNAME VALUE 'FKTAB'. DATA: COND_TAB LIKE DDWHERECND OCCURS 0 WITH HEADER LINE. DATA: ADAPTED_FIELDS LIKE DDTABFDS OCCURS 0 WITH HEADER LINE. DATA: FAILURE_TAB LIKE DDFKEYRC OCCURS 0 WITH HEADER LINE. FKTAB-F1 = ..... FKTAB-F2 = ..... ... FKTAB-FN = ..... CALL FUNCTION 'DDUT_FORKEY_CHECK' EXPORTING TABNAME = TABNAME VALUE_LIST = FKTAB TABLES COND_TAB = COND_TAB FAILURE_TAB = FAILURE_TAB EXCEPTIONS FORKEY_NOT_DEFINED = 1 TABLE_NOT_ACTIVE = 2 FIELD_UNKNOWN = 3. ..... |