Capturing Changes in PA Infotypes

This document will help capturing the changes in PA infotypes (specifically IT0000) pragmatically and show the results in an ALV output, The same procedure can be used to send the outbound file using OPEN DATASET statement.

Configuration Part:

For capturing changes in PA infotypes, SPRO configuration is as below:

Go to IMG->Personnel Management->Personnel Administration->Tools->Revision->Set up change document [The same can be achieved by maintaining customizing tables T585A, T585B and T585C respectivelly].

1.JPG

Now, in the following screen that pop-ups, configure the infotype and fields whose changes need to be logged as below:

1. In the first step, select ‘HR documents: Infotypes to be logged’ as below:

2.JPG

a. Click on the new entries and add the entries as in following screen shot and save.

3.JPG

b.Maintain Transaction Class ‘A’ for master data, Infotype ‘0000’ (to log infotype ‘0000’ changes)[This screen can directly be encountered by maintaining view           V_T585A from SM30 tcode].

4.JPG

2. Now, select the second activity ‘HR documents: Field group definition’ to configure other relevant details as below:

5.JPG

a.  Click on the new entries and add the entries as in following screen shot and save.

6.JPG

b. Maintain Infotype as ‘0000’, field group as ’01’ and field name as ‘*’ to log changes in any field of infotype ‘0000’.[This screen can directly be encountered by          maintaining view V_T585B from SM30 tcode].

7.JPG

3. Now, select the third and last activity ‘HR documents: Field group characteristics’ to configure other relevant details as below:

8.JPG

a. Click on the new entries and add the entries as in following screen shot and save.

10.JPG

b. Maintain transaction class as ‘A’, infotype ‘0000’, field group ’01’ and Doc type as ‘L’.[This screen can directly be encountered by maintaining view V_T585C          from SM30 tcode].

10.JPG

Here, field Doc. type is of particular importance and can have values either ‘S’ or ‘L’ as per SAP F1 documentation:

Long-term documents (L) are sorted by personnel number and infotype. They are used for revision purposes, in other words to find out who changed, deleted or created what and when.

Short-term documents (S) are sorted by the date on which the last change was made. They can be used to link external systems to the SAP System. In this way, customer-specific programs can be used to evaluate short-term documents and the modified data can then be transferred to the external system.

One-stop way to do all the above configuration is through view cluster VC_T585ABC using tcode SM34 and maintaining all relevant details as in screenshot below.

11.JPG

Coding Part:

There are two function modules HR_INFOTYPE_LOG_GET_LIST and HR_INFOTYPE_LOG_GET_DETAIL are used to fetch the changes made to PA infotypes (from PCL4 cluster table). These function module are used to retrieve the changed data logged in PCL4 cluster.

All the changes made to the PA infotypes for which change logs are activated in Configuration part, changes are logged in PCL4 cluster table with area id (RELID) as ‘LA’ or ‘SA’ based on the last configuration step Doc. type field.

RELID Description
LA For Doc. type ‘L’ in T585C customizing table
SA For Doc. type ‘S’ in T585C customizing table

Please note that the Doc type ‘L’ needs to be maintained to capture changes in function module HR_INFOTYPE_LOG_GET_LIST.

Now, we will see how to use the above mentioned function modules to fetch the change log and store in an internal table.

Function module HR_INFOTYPE_LOG_GET_LIST can be used as below to get infotype log key table which will be used in the function module  HR_INFOTYPE_LOG_GET_DETAIL to get the change log details as below.

12.JPG

The above fetched log key internal table t_infty_logg_key_tab entries are used as below to fetch all the relevant details as below.

t_before and t_after internal tables will be further used to determine the type of change(insert/change/delete) and get the change log entries.

13.JPG

Selection Screen:

14.JPG

Output:

15.JPG

Was this article helpful?

Related Articles

Leave A Comment?

You must be logged in to post a comment.