SAP Function Modules

DD_FORKEY_GET SAP Function module - Show foreign key structure for fields







DD_FORKEY_GET is a standard SAP function module available within R/3 SAP systems depending on your version and release level. Below is the pattern details for this FM showing its interface including any import and export parameters, exceptions etc as well as any documentation contributions (Comments) specific to the object.

See here to view full function module documentation and code listing, simply by entering the name DD_FORKEY_GET into the relevant SAP transaction such as SE37 or SE80.

Associated Function Group: SDD8
Released Date: Not Released
Processing type: Normal fucntion module
Normal function module settings


Pattern for FM DD_FORKEY_GET - DD FORKEY GET





CALL FUNCTION 'DD_FORKEY_GET' "Show foreign key structure for fields
  EXPORTING
    feldname =                  " dd05p-fieldname  Field name of the field to be checked
*   sprache = 'D'               " dd05p-ddlanguage
*   sprache = 'D'               " dd05p-ddlanguage  Selection language default 'D'
    tabname =                   " dd05p-tabname
    tabname =                   " dd05p-tabname  Table name of the field to be checked
  TABLES
    forkeytab =                 " dd05p         Table foreign key relationships
  EXCEPTIONS
    NOT_EQUAL = 1               "               Tables of the involved fields are different
    NOT_FOUND = 2               "               Foreign key for entry does not exist
    NOT_VALID = 3               "               Foreign key definition is not complete
    .  "  DD_FORKEY_GET

ABAP code example for Function Module DD_FORKEY_GET





The ABAP code below is a full code listing to execute function module DD_FORKEY_GET including all data declarations. The code uses the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the original method of declaring data variables up front. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8).

DATA:
it_forkeytab  TYPE STANDARD TABLE OF DD05P,"TABLES PARAM
wa_forkeytab  LIKE LINE OF it_forkeytab .


SELECT single FIELDNAME
FROM DD05P
INTO @DATA(ld_feldname).


SELECT single DDLANGUAGE
FROM DD05P
INTO @DATA(ld_sprache).


SELECT single DDLANGUAGE
FROM DD05P
INTO @DATA(ld_sprache).


SELECT single TABNAME
FROM DD05P
INTO @DATA(ld_tabname).


SELECT single TABNAME
FROM DD05P
INTO @DATA(ld_tabname).


"populate fields of struture and append to itab
append wa_forkeytab to it_forkeytab. . CALL FUNCTION 'DD_FORKEY_GET' EXPORTING feldname = ld_feldname * sprache = ld_sprache * sprache = ld_sprache tabname = ld_tabname tabname = ld_tabname TABLES forkeytab = it_forkeytab EXCEPTIONS NOT_EQUAL = 1 NOT_FOUND = 2 NOT_VALID = 3 . " DD_FORKEY_GET
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 2. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 3. "Exception "Add code for exception here ENDIF.







ABAP code to compare 7.40 inline data declaration with original syntax

The below ABAP code uses the older none in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. It may also be useful if you are using an older version of SAP as some of the newer syntax above, such as the @DATA is not available until 4.70 EHP 8.

DATA:
ld_feldname  TYPE DD05P-FIELDNAME ,
it_forkeytab  TYPE STANDARD TABLE OF DD05P ,
wa_forkeytab  LIKE LINE OF it_forkeytab,
ld_sprache  TYPE DD05P-DDLANGUAGE ,
ld_sprache  TYPE DD05P-DDLANGUAGE ,
ld_tabname  TYPE DD05P-TABNAME ,
ld_tabname  TYPE DD05P-TABNAME .


SELECT single FIELDNAME
FROM DD05P
INTO ld_feldname.


"populate fields of struture and append to itab
append wa_forkeytab to it_forkeytab.

SELECT single DDLANGUAGE
FROM DD05P
INTO ld_sprache.


SELECT single DDLANGUAGE
FROM DD05P
INTO ld_sprache.


SELECT single TABNAME
FROM DD05P
INTO ld_tabname.


SELECT single TABNAME
FROM DD05P
INTO ld_tabname.

Contribute (Add Comments)

Please help keep this info upto date and use the comments section below to add useful hints, tips and information specific to this SAP function. This will then be available for you and other users to easily find by simply searching on the object name DD_FORKEY_GET or its description.