Homelab, Linux & ABAP (~˘▾˘)~
 

[ABAP] Find fullname for sy-uname

Via Infotype

    TRY.
        DATA(lo_employee_api) = cl_hcmfab_employee_api=>get_instance( ).
        DATA(lv_pernr)        = lo_employee_api->get_employeenumber_from_user( sy-uname ).
        DATA(lv_ename)        = lo_employee_api->get_name( lv_pernr ).
      CATCH cx_hcmfab_common.
    ENDTRY.

or via SU01

    TRY.
        DATA(lv_ename) = NEW /xiting/cl_su01_read( sy-uname )->get_fullname( ).
      CATCH /xiting/cx_user.
    ENDTRY.

Leave a Reply

Your email address will not be published. Required fields are marked *