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

[ABAP] Read Infotype

DATA: ls_p0001           TYPE p0001,
      lt_p0001           TYPE TABLE OF p0001,  
      lr_infotype_reader TYPE REF TO if_hrpa_read_infotype, 
      lt_infotype        TYPE hrpad_prelp_tab, 
      ls_infotype        TYPE prelp, 
      lv_missing_auth    TYPE boole_d 
      lv_data_exists     TYPE boole_d. 

* Infotyp reader initialisieren
   CALL METHOD cl_hrpa_read_infotype=>get_instance
     IMPORTING
       infotype_reader = lr_infotype_reader.

 * Infotyp 1 lesen
   CLEAR lt_infotype.
   CALL METHOD lr_infotype_reader->read
     EXPORTING
       tclas         = 'A'
       pernr         = lv_pernr
       infty         =  '0001' 
       begda         = iv_begda
       endda         = iv_endda
       no_auth_check = abap_true
     IMPORTING
       infotype_tab  = lt_infotype
       data_exists   = lv_data_exists
       missing_auth  = lv_missing_auth.

   LOOP AT lt_infotype INTO ls_infotype.
     CALL METHOD cl_hr_pnnnn_type_cast=>prelp_to_pnnnn
       EXPORTING
         prelp = ls_infotype
       IMPORTING
         pnnnn = ls_p0001.
        APPEND ls_p0001 TO lt_p0001.
   ENDLOOP.