[ABAP] HR: Mitarbeiterdaten lesen

TRY.
    DATA(o_eapi) = cl_hcmfab_employee_api=>get_instance( ).

    DATA(lv_pernr) = o_eapi->get_employeenumber_from_user( sy-uname ).
    DATA(lv_name) = o_eapi->get_name( lv_pernr ).
    DATA(lv_details) = o_eapi->get_employee_details( iv_pernr = lv_pernr iv_application_id = if_hcmfab_constants=>gc_application_id-mypersonaldata ).

    cl_demo_output=>write_data( lv_pernr ).
    cl_demo_output=>write_data( lv_name ).
    cl_demo_output=>write_data( lv_details ).
  CATCH cx_root INTO DATA(e_txt).
    WRITE: / e_txt->get_text( ).
ENDTRY.

[ABAP] HR: Infotypen lesen

cl_hcmfab_employee_api / cl_hcmfab_utilities

TRY.
    DATA(o_eapi) = cl_hcmfab_employee_api=>get_instance( ).

    DATA(lv_pernr) = o_eapi->get_employeenumber_from_user( sy-uname ).

    DATA p0002 TYPE p0002.
    cl_hcmfab_utilities=>read_infotype_record( EXPORTING iv_pernr = lv_pernr
                                                         iv_infty = '0002'
                                               IMPORTING es_pnnnn = p0002 ).

    WRITE: / p0002-nachn.

  CATCH cx_root INTO DATA(e_txt).
    WRITE: / e_txt->get_text( ).
ENDTRY.

HR_READ_INFOTYPE

DATA: lv_pernr TYPE pa0002-pernr.

SELECT-OPTIONS: s_pernr FOR lv_pernr.
SELECT-OPTIONS: s_date FOR sy-datum.

START-OF-SELECTION .

  DATA: it_p0002 TYPE TABLE OF p0002 WITH DEFAULT KEY.

  CALL FUNCTION 'HR_READ_INFOTYPE'
    EXPORTING
      tclas           = 'A'    " A - Mitarbeiter, B - Bewerber
      pernr           = s_pernr-low
      infty           = '0002' " Infotyp muss mit der Rückgabetabelle für infty_tab korresponieren (z.B. infty = '0002', infty_tab = it_p0002 (TYPE TABLE OF p0002 WITH DEFAULT KEY))
      begda           = s_date-low
      endda           = s_date-high
    TABLES
      infty_tab       = it_p0002
    EXCEPTIONS
      infty_not_found = 1
      OTHERS          = 2.

  IF sy-subrc = 0.
    cl_demo_output=>display( it_p0002 ).
  ENDIF.