Infotypes in SAP HCM hold time-dependent information which
means that some information maintained in infotypes become invalid after the
end date for that particular record. Very often, we come across requirements
where any change in employee’s PA data needs to be captured and sent as across
as a report or as files to a third party system via interfaces.
SAP provides a standard report RPUAUD00 for displaying the
infotype logs. Here is one way how we can achieve this in our custom programs.
Configuration
The views V_T585A, V_T585B, V_T585C need to be configured to
ensure that the changes for the required infotypes (and fields in it) are being
logged.
Custom program
In order to read the change logs, we can make use of function
modules HR_INFOTYPE_LOG_GET_LIST and HR_INFOTYPE_LOG_GET_DETAIL provided by
SAP. The former gets the list of changes for the specified time period (import
parameters BEGDA and ENDDA), personnel numbers (Tables PERNR_TAB) and infotypes
(Tables INFTY_TAB). All changes are populated in INFTY_LOGG_KEY_TAB. This would
be the input for the second FM to get details of the change log ie. HR_INFOTYPE_LOG_GET_DETAIL.
The output of this function module would give the field values of infotypes before
and after the change in tables INFTY_TAB_BEFORE and INFTY_TAB_AFTER. The
information in these tables are semi-transparent. This can be converted to a
transparent (infotype table format) using class method
CL_HR_PNNNN_TYPE_CAST=>PRELP_TO_PNNN. The output of this method (PNNNN) would
have the structure of an infotype and can be used to produce output of your
program or to create a file.