[ABAP] SELECT-OPTIONS Auswahldialog anzeigen

Variante 1 (RANGE)

DATA: rg_matnr TYPE RANGE OF matnr.

CALL FUNCTION 'COMPLEX_SELECTIONS_DIALOG'
  EXPORTING
    title             = 'Auswahl'
    text              = 'Materialnummern'
  TABLES
    range             = rg_matnr
  EXCEPTIONS
    no_range_tab      = 1
    cancelled         = 2
    internal_error    = 3
    invalid_fieldname = 4
    OTHERS            = 5.

IF sy-subrc = 0.
  cl_demo_output=>display( rg_matnr ).
ENDIF.

Variante 2 (RSTABFIELD)

DATA(lv_tab_field) = VALUE rstabfield( tablename = 'CSKS' fieldname = 'KOSTL' ).

DATA: rg_test TYPE RANGE OF csks-kostl.

CALL FUNCTION 'COMPLEX_SELECTIONS_DIALOG'
  EXPORTING
    title             = 'Auswahl'
    text              = 'Kostenstelle'
    tab_and_field     = lv_tab_field
    help_field        = 'CSKS-KOSTL'
  TABLES
    range             = rg_test
  EXCEPTIONS
    no_range_tab      = 1
    cancelled         = 2
    internal_error    = 3
    invalid_fieldname = 4
    OTHERS            = 5.

IF sy-subrc = 0.
  cl_demo_output=>display( rg_test ).
ENDIF.