[ABAP] ALV – Auswahlpopup für Selektion einer Anzeigevariante anzeigen

DATA: ls_variant LIKE disvariant.
DATA: lv_exit TYPE c.

PARAMETERS p_vari LIKE disvariant-variant.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_vari.

  CLEAR ls_variant.

  ls_variant-report = sy-repid.
  ls_variant-username = sy-uname.

  CALL FUNCTION 'REUSE_ALV_VARIANT_F4'
    EXPORTING
      is_variant    = ls_variant
      i_save        = 'A'
    IMPORTING
      e_exit        = lv_exit
      es_variant    = ls_variant
    EXCEPTIONS
      not_found     = 1
      program_error = 2
      OTHERS        = 3.

  IF sy-subrc NE 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ELSE.
    IF lv_exit EQ space.
      p_vari = ls_variant-variant.
    ENDIF.
  ENDIF.