Payroll PCR for Employee Late Deductions with Grace Time
In this blog I want to explain about a peculiar scenario, where a client wants to deduct salary for late coming hours in payroll. Employees are allowed to take grace time for first 2 occurrences of 0.5 Hours of Late in a full payroll month, and beyond that, the actual deduction should happen. If the late hours are more than 0.5 hours in a day, there is no grace late time allowed on that day.
Client has not implemented SAP Time Management module. So the late hours will be uploaded into Payroll’s Infotype 0015 (Additional Payments) with Num field filled with late hours for each day. We need to eliminate the first two grace 0.5 hours and remaining has to be totaled and deduction should happen on this total hours.
In case of Basic Pay split in a month, the client wants to consider the last split of Basic Pay amount to calculate the deduction base amount.
I wrote some PCR’s to achieve this.
We can achieve this requirement by using payroll PCR’s (Personnel Calculation Rules) and few wage types. These PCR’s are placed in the Indian Payroll Sub-Schema INAP of IN00 (here I am using YNAP which is copied in customer namespace). We also need to create two constants ZLTLH, ZLTLM in table V_T511K for storing the grace time allowed value (0.5) and grace limit allowed value (2). These values can be adjusted as per client’s requirements.
Constants or Payroll Parameters used in calculation:
I am demonstrating this in Indian Payroll, but this can be used in any country version. I also demonstrate how we can read and store the wage type’s last split value in a variable and nesting of PCR (calling a PCR inside another sub-PCR using GCY command).
Schema YNAP (copied from INAP) and the PCR’s Usage:
Transaction Code: PE01
I am using the following wage types for calculation and deduction purpose:
- 9001 – Late Input Hrs (Entered in IT0015 as input)
- 9002 – Late Output Amount (Deduction Wage type)
- 9003 – Late Grace Hours (to store total grace hours taken in a month)
Configuration for above wage types:
Wage type 9001 and 9003 will have the same configuration settings.
I am using the following PCR’s to achieve this requirement:
Transaction Code: PE02
PCR ZSP1: Used to read the last split value of wage type /001 which is hourly rate of the employee’s basic salary and this is stored in a temporary variable HRRT. This is required to calculate the late deduction amount.
PCR ZLT1: Used to process the input values of late hours (wage type 9001) which are uploaded/entered in infotype IT0015. This PCR also eliminates the grace time i.e first two half hours (0.5 hours) and that is stored in another wage type 9003 (Grace Time) for reporting purpose. This PCR also calculates the total number of late hours to be deducted and stored in a wage type 9002 (Late amount). This PCR checks the values of constants ZLTLM and ZLTLH to find the grace occurrence and grace hours. Here Nesting of PCR’s are used to with GCY to branch the if..else condition (with ESG for PCR A and B). The branch A adds the hours into deduction wage type 9002 and branch B eliminates the grace hours by adding into wage type 9003.
PCR ZLT2: Used to calculate the deduction amount of wage type 9002 with variable HRRT which is having the last split of hourly rate value.
Testing of above PCR’s in payroll schema IN00 (Sub-schema INAP copied as YNAP):
Infotype IT0008 – Basic Pay with split in a payroll month:
Infotype IT0015 – Late Hours Input values for the month April-2020:
Here there are 3 half hour late values and 2 one hour late values (total 3.5 hours). First 2 half hours are grace time and remaining hours (2.5 hours) are to be deducted from employee’s salary.
Remuneration Statement for above Test Case:
Calculation of 0.5 Hours Late Deducton shown in Late Output Amt:
Last Split of Basic salary -> 66000 INR
Hourly Rate -> 66000 / 20 (Days) / 8 (Hours) -> 412.50 INR
2.5 Hours Deduction = 412.50 * 2.5 -> 1031.25 INR.
Payroll Processing Logs of this scenario:
PCR ZSP1 Log:
PCR ZLT1 Log:
Let us analyze the processing of PCR ZLT1 which processes Late Hours input wage type 9001. This pcr compares WT 9001’s RTE value with constant value ZLTLM (value 2) to check whether we reached the late limit of 2 times in a month. Next it compares NUM value of WT 9001 with constant ZLTLH (value 0.5) to check whether this value is eligible for grace value. Then it branches through section A or B of this PCR based on the condition’s return value with logical operator. This will run for all the input values of WT’s 9001 in sequence and every time the flag value LTLT is incremented on successful completion of a comparison of grace limit hours (0.5 in this case).
When PCR ZLT1 branches to ‘A’ section, grace is not given (value is added to Wage type 9002) and when it branches to ‘B’ section, grace is given (value is added to Wage type 9003).
Processing of Input Wage type 9001 – 1st Late Hours (1.00 Hours):
Since this is greater than 0.5 Hours (value ZLTLH) this is not a grace time, so added to Wage type 9002.
Processing of Input Wage type 9001 – 2nd Late Hours (0.5 Hours):
This is the first 0.5 hour which is grace time and hence added to wage type 9003.
Processing of Input Wage type 9001 – 3rd Late Hours (0.5 Hours):
This is the 2nd 0.5 hour which is grace time and hence added to wage type 9003.
Processing of Input Wage type 9001 – 4th Late Hours (1.00 Hours):
This is the 4th value (1.00 hour) this is not a grace time, so added to Wage type 9002.
Processing of Input Wage type 9001 – 5th Late Hours (0.5 Hours):
Since already 2 grace values are passed, this 0.5 hours value will not be considered for grace value and hence this is added to WT 9002.
We got below output:
9003 – Late Grace = 1 Hour (0.5 + 0.5)
9002 – Late Output = 2.5 Hours (1+1+0.5)
PCR ZLT2 Log:
Thus, we achieved the grace time calculation and deducted the salary for late coming hours in an environment, where there is no Time Management module is implemented.
With this, I would like to end this blog. Your comments are welcome.