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

[ABAP] Read infotype records

* Read multiple infotype records
DATA: ls_p0001 TYPE p0001,
      lt_p0001 TYPE TABLE OF p0001.

* Initialise Infotyp reader 
cl_hrpa_read_infotype=>get_instance( IMPORTING infotype_reader = DATA(lr_infotype_reader) ).

* Read Infotyp 1
lr_infotype_reader->read( EXPORTING tclas         = 'A'
                                    pernr         = 6
                                    infty         = '0001'
                                    begda         = '01011900'
                                    endda         = '31129999'
                                    no_auth_check = abap_true
                          IMPORTING infotype_tab  = DATA(lt_infotype)
                                    data_exists   = DATA(lv_data_exists) ).

LOOP AT lt_infotype INTO DATA(ls_infotype).
  cl_hr_pnnnn_type_cast=>prelp_to_pnnnn( EXPORTING prelp = ls_infotype
                                         IMPORTING pnnnn = ls_p0001 ).
  APPEND ls_p0001 TO lt_p0001.
ENDLOOP.

cl_demo_output=>display( lt_p0001 ).

Leave a Reply

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