[ABAP] Rolle eines Mandanten bestimmen

* aktueller Mandant
DATA(man) = cl_abap_syst=>get_client( ).

* verfügbare Mandanten
SELECT SINGLE *
  INTO @DATA(lv_t000)
  FROM t000
  WHERE mandt = @man.

IF sy-subrc = 0.
  DATA(it_dd07v_tab) = VALUE dd07v_tab( ).
  DATA(lv_rc) = VALUE sy-subrc( ).

* DDextern: Externe Schnittstelle zum Lesen der Domänenfestwerte
  CALL FUNCTION 'DD_DOMVALUES_GET'
    EXPORTING
      domname        = 'CCCATEGORY' " Feld CCCATEGORY: Client Control: Rolle des Mandanten (Productive, Test,...)
      text           = abap_true    " Text holen
    IMPORTING
      rc             = lv_rc
    TABLES
      dd07v_tab      = it_dd07v_tab
    EXCEPTIONS
      wrong_textflag = 1
      OTHERS         = 2.
  IF sy-subrc = 0.
    IF lv_rc = 0.
      IF line_exists( it_dd07v_tab[ domvalue_l = lv_t000-cccategory ] ).
        DATA(lv_dd07v) = it_dd07v_tab[ domvalue_l = lv_t000-cccategory ].

* logisches System, Mandant und Kategorietext ausgeben
        WRITE: / lv_t000-logsys, lv_dd07v-ddtext.
      ENDIF.
    ENDIF.
  ENDIF.
ENDIF.