DATA(work_schedule) = cl_hcmfab_employee_api=>get_instance( )->get_work_schedule( iv_pernr = 1
iv_begda = sy-datum
iv_endda = sy-datum ).
cl_demo_output=>display_data( work_schedule ).
Tag: CL_HCMFAB_EMPLOYEE_API
[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
DATA(lv_ename) = NEW cl_hreic_appl_utilities( )->get_user_name( sy-uname ).
[ABAP] Read personnel area with text
DATA p0001 TYPE p0001.
cl_hcmfab_utilities=>read_infotype_record( EXPORTING iv_pernr = pernr
iv_infty = '0001'
IMPORTING es_pnnnn = p0001 ).
DATA(personnel_area_id) = p0001-werks.
DATA(personnel_area_text) = cl_hr_t500p=>read( p0001-werks )-name1.
Or using the class CL_HCMFAB_EMPLOYEE_API.
DATA(lv_employee_details) = cl_hcmfab_employee_api=>get_instance( )->get_employee_details( iv_pernr = pernr
iv_application_id = if_hcmfab_constants=>gc_application_id-mypersonaldata ).
DATA(personnel_area_id) = lv_employee_details-personnel_area_id.
DATA(personnel_area_text) = lv_employee_details-personnel_area_text.
[ABAP] User ↔ Employeenumber
Class:
– CL_HCMFAB_EMPLOYEE_API
Methods:
– GET_USERID_FROM_EMPLOYEENUMBER
– GET_EMPLOYEENUMBER_FROM_USER
How to use the class:
TRY.
DATA(lv_pernr) = cl_hcmfab_employee_api=>get_instance( )->get_employeenumber_from_user( sy-uname ).
CATCH cx_hcmfab_common.
ENDTRY.
TRY.
DATA(lv_uname) = cl_hcmfab_employee_api=>get_instance( )->get_userid_from_employeenumber( lv_pernr ).
CATCH cx_hcmfab_common.
ENDTRY.