[ABAP] SAP-User zu einem Familiennamen suchen

TYPES: BEGIN OF ty_user,
         bname      TYPE usr21-bname,
         name_first TYPE adrp-name_first,
         name_last  TYPE adrp-name_last,
       END OF ty_user.

DATA: lv_nlast TYPE adrp-name_last.
DATA: it_user TYPE STANDARD TABLE OF ty_user.

SELECT-OPTIONS: so_nlast FOR lv_nlast.

START-OF-SELECTION.

  SELECT u~bname, a~name_first, a~name_last
    FROM adrp AS a
    INNER JOIN usr21 AS u
    ON a~persnumber = u~persnumber
    INTO CORRESPONDING FIELDS OF TABLE @it_user
    WHERE a~name_last IN @so_nlast.

  IF sy-subrc = 0.
    SORT: it_user BY bname.

    LOOP AT it_user ASSIGNING FIELD-SYMBOL(<fs_line>).
      WRITE: / <fs_line>-name_last, <fs_line>-name_first, <fs_line>-bname.
    ENDLOOP.
  ELSE.
    WRITE: / 'Keine Suchergebnisse.'.
  ENDIF.