Skip to Content

Payroll evaluation is tricky for the beginners and even for developers with any other background. Here I am listing an example code to accomplish it but before jumping directly to the code, lets go into some basics. Please find about data clusters on SAP Help portal here and more here. Cluster databases have a definite structure. SAP Help Portal provides this information here with the help of an example table INDX which SAP has created for use by customers.

First, Time management data and Payroll data is stored in (data) clusters on the database and not directly in the transparent tables we are used to. This data can only be read with the help of SAP provided Macros and Function Modules. The info about the clusters is stored in transparent table PCL2 as follows:

Pic1_PCL2.jpg

RELID (Relations ID) is the 2-character name of the cluster e.g.CU, RD (Payroll results-US), RX (Payroll results-International), B2 (Time management results), ZL (Personal shift plan), PS (Generated schema), PT (Texts for generated schema), etc.

SRTFD stores the key for the table PCL2. SRTF2 is the sort field so as to store a duplicate key as the first 4 fields are the key fields of the table.

PGMID is the name of the program which carried out the last update on the cluster and CLUSTD stores the actual payroll data.

The standard country-specific payroll programs (RPCALCn0 – n stands for country version) write the results to PCL2. An overview of the payroll results can be accessed from the cluster directory in cluster CU for a specified period. Every employee on the payroll has its records in the cluster directory. Its structure as follows :

Pic2_PC261.jpg

SEQNR denotes the running sequence numbers for payroll results with next payroll result against the next sequence number. FPPER stores the period for which payroll run was carried out and INPER stores in which period it was carried out. For retroactive accounting, you can carry out payroll run for the past period/s in the current period.

This cluster directory from the cluster CU is stored in a database table HRPY_RGDIR (Directory for Payroll results) redundantly so that Logical database PNP can access it for evaluating payroll results.

Pic3_HRPY_RGDIR.jpg

There is another transparent table HRPY_WPBP which stores data from the table WPBP (Work Place / Basic Pay) of the cluster RX, redundantly for Logical database PNP again. The structure for the table in the cluster is represented by structure PC205.

Pic4_HRPY_WPBP.jpg

Let us talk about evaluating payroll results now. To help in accessing the payroll results, there are country-specific logical structures which are filled during evaluation process. Evaluation process may involve the use of standard Function modules or GET PAYROLL event of the PNP logical database. This logical structure is represented by PAYXY_RESULT. XY represents the ISO code of the country which is stored in table T500L as follows :

Pic5_T500L.jpg

The table T500L above also displays the country specific cluster name in the PCL2 table. Coming back to logical structure PAYXX_RESULT, it is PAYUS_RESULT for US from the above table, shown below :

Pic6_PAYUS_RESULT.jpg

During run-time, Structure EVP holds the data from the directory of cluster CU. Structures INTER and NAT are deep structures and hold international and national component of the payroll.PAYUS_RESULT-INTER has further sub-structures/tables like VERSC (payroll status information), WPBP, RT (Results table), CRT (Cumulative Results table), etc.

Cluster CU has a table RGDIR which stores a row for each payroll run per employee. Standard report H99_DISPLAY_PAYRESULT can be used to display payroll results.

Attaching a sample program for fetching payroll results implementing the above concept and using Function modules CU_READ_RGDIR and PYXX_READ_PAYROLL_RESULT. You can simply copy and paste the code from here and execute it and check the functionality. It throws an ALV output using class CL_SALV_TABLE. Debug it to understand the flow. All the Best !

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply