Wednesday, May 13, 2009

Get domain value range through DDIF_DOMA_GET

Get value range/fixed values in data dictionary domain via function module. In my case, domain 'ZPSTAT'

FORM get_zpstatus.
DATA l_name LIKE dcobjdef-name.
DATA it_dd07v LIKE dd07v OCCURS 0 WITH HEADER LINE.

l_name = 'ZPSTAT'.
CALL FUNCTION 'DDIF_DOMA_GET'
EXPORTING
name = l_name
langu = sy-langu
TABLES
dd07v_tab = it_dd07v
EXCEPTIONS
illegal_input = 1
OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.

SORT it_dd07v BY domvalue_l.

LOOP AT it_dd07v where domvalue_l eq p0054-zpstatus.
zpstatus_text = it_dd07v-DDTEXT.

ENDLOOP.

ENDIF.

ENDFORM.

No comments:

Post a Comment