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

[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.

[HR] Infotype – add PBO or PAI logic

There are many ways to add custom logic when processing an Infotype. Here are just a few:

SMOD
PBAS0001
PBAS0002

ZXPADU01 – when an infotype is called
ZXPADU02 – when an action is performed on an infotype

https://regotz.jimdofree.com/abap/dynpro/infotypen-pai-pbo/

BAdI’s

  • HRPAD00INFTY (method IN_UPDATE) is called by the old infotype framework (PA30, SAP50UPR)
  • HRPAD00INFTYDB (method UPDATE_DB) is called in the decoupled infotype framework

BAdI: HRPAD00INFTY – Verbucher / Infotyp-Pflege

This image has an empty alt attribute; its file name is image-1.png
This image has an empty alt attribute; its file name is image-2.png
Interface: IF_EX_HRPAD00INFTY

BAdI: HRPAD00INFTYDB – HR: Stammdaten, Infotype DB Update Logik

“The BAdI is called, after the decoupled infotype framework writes the infotype data to the database. This is done during method FLUSH.”
Note: The Infotypes 2000-2999 are not decoupled yet! More here and here.

IF_EX_HRPAD00INFTYBL
IF_EX_HRPAD00INFTYDB

[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.