HCM Programming

Get employee ID

DATA(employee_api) = cl_hcmfab_employee_api=>get_instance( ).
DATA(pernr) = employee_api->get_employeenumber_from_user( ). "Scenario, where one user has 1 employment (1 employee ID assigned)
"To retrieve employee IDs for multiple employment
DATA(pernrs) = employee_api->get_assignments( pernr ).

Get employee name

cl_hcm_employee_api=>get_instance( )->get_employeename(
  EXPORTING
    iv_pernr      = pernr "Employee ID
    iv_begda      = sy-datum
    iv_endda      = co_doomsday "99991231
    iv_auth_check = abap_false
).

Get employee photo URL

CALL METHOD cl_hcm_photo_api=>get_employee_photo
   EXPORTING
     iv_pernr = pernr "Employee ID
   IMPORTING
     ev_photo_url = DATA(url)
     ev_mime_type = DATA(mime_type)

SAPDEV.EU
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.