I recently came across a very challenging requirement where client wanted to grant prorated absence quota to a contractor for the contract period in time evaluation run on the first day of his contract. In this knowledge artifact, I will explain the requirement in detail, challenges in designing the solution and finally the actual solution and testing.
Our client requirement was to give pro-rated grant of annual leave absence quota to a contractor for the contract period in time evaluation run on the first day of his contract. The contract could last for any duration from few months to a year and can overlap across two years.
The annual leave absence quota for a contract period of 1 year was 20 days. Hence, if the contract period is from 01-Nov-13 till 30-Apr-14, then the contractor should be granted annual leave absence quota only for 6 months.
Also, the validity and deduction intervals for the annual leave absence quota should be from 01-Nov-13 till 30-Apr-14.
Let us go through the key challenges in meeting the client requirements. There were three key challenges in designing the solution for the requirements:
- How do we ensure that the absence quota validity and deduction intervals are for the contract period?
- How do we ensure that prorated grant of annual leave absence quota happens on the first day of contract period?
- How do we ensure that if the contract period gets extended, the new absence quota record will get validity and deduction intervals as per the new contract period?
Let us go and analyze the validity and deduction interval screen. Below is the screenshot of the screen.
Since the absence quota period will be completely dependent on the contract period, we are not left with any option but to use the date type. Using date types, we can actually specify the start and end of validity and deduction intervals based on the contract period.
We will require two date types – one for contract start date and another for contract end date. Each time the contract gets renewed, we will delimit the IT0041 record and update the new contract start date and contract end date for the date types.
Generally, the concept of proration of absence quota is done using reduction rule. The reduction rule determines the period for which the employee is inactive and accordingly, prorates the quota of the base period. Please refer the below screenshot of a sample reduction rule Z1.
Why can’t we use the reduction rule in our scenario? The reason is that there is no way to find out the contract period for which the employee is active if the contract period is spanning across two years.
The base entitlement is defined for a calendar year (Base period in above screenshot) and if both the start date and end date of the contract period fall in the same calendar year, it is easy to determine the inactive period of the employee in a given calendar year.
However, if the start date of the contract period falls in one calendar year and end of the contract period falls in next calendar year, it becomes difficult for the system to calculate the inactive period in the base period.
This was the biggest challenge for me in designing the solution to meet the client’s requirements.
To get around this, I thought of finding the prorated grant of quota for a day and then multiple it by the no. of days in the contract period and generate quota as per the contract period on the first day of contract.
Let us move onto solution design where I will explain everything in detail.
Let me first create two date types for contract start date and contract end date.
We will create a daily time type ZAR3 in Table V_T555A. This time type will be generated only on the contract start date and based on this time type, the accrual and entitlement will happen only on the contract start date. The time type will store the no. of days in the contract period.
We will need to create an absence quota – Contractor Annual Leave – in Table V_T556A.
We select generation of contractor annual leave in time evaluation run in Table V_556A_B.
Let us define the base entitlement of 20 days for a calendar year in Table V_T559E.
We will now define the quota validity and deduction intervals in Table V_T559D.
Let us now define generation rules for absence quota in Table V_T559L. The absence quota is assigned to absence quota group 03.
The setting has been set at daily accrual so that the grant will happen on a daily basis. However, the grant of prorated base entitlement will be controlled using a daily time type ZAR3. On the contract start date, this time type will get generated and the accrual will happen only on the contract start date.
The above configuration is very important one. The radio button “Pro rata calculation” is checked. This means that daily grant of 20 days for a calendar year is prorated to a daily grant for a day.
We have mentioned time type ZAR3 in day balance. Hence, the total no. of days in contract period multiplied by the daily prorated grant will give the total grant for the contract period.
The generated absence quota will be immediately transferred to the employee.
We will need to create a custom PCR ZAR3 to calculate the total no. of contract days as shown in the screenshot below:
The PCR ZAR3 finds the difference between the date of time evaluation and date type Y1 in days using HRS=YDAAY1. It compares the value with 0 using HRS?0.
If the value is not equal to 0, it means that this is not the start of contract date and then the PCR gets processed under *.
Under *, the no. of hours is set to 0 using HRS=0.0 and added to time type ZAR3 using ADDDBZAR3Z. This means that the time type ZAR3 won’t get generated on this day and there won’t be any grant of quota on this day.
If the value is equal to 0, it means that the date of time evaluation is also the contract start date and then the PCR gets processed under =.
Under =, the PCR finds the difference between “Date of Time Evaluation – 1” and “Contract End Date” using HRS=YDRAY3. Why are we using “Date of Time Evaluation – 1”? Because the difference between contract start date and contract end date will be less than 1 day.
Let us assume that the contract start date is 01-Jan and contract end date is 31-Jan. The difference between two dates is 30 days. Hence, we need to add one more day to the difference to arrive at 31 days which is the duration of contract period.
The difference between “Date of Time Evaluation – 1” and “Contract End Date” using HRS=YDRAY3 is a negative value and hence, needs to be multiplied with – 1 using HRS*-1 to get a positive value. This positive value is finally added to time type ZAR3 using ADDDBZAR3Z and the time type gets generated on the contract start date.
We will need to add this PCR ZAR3 in our time schema before Functions CUMBT and QUOTA as shown in the screenshot below:
Now, the solution design is complete. Let us proceed to test this solution.
Let us complete the master data set up to test solution.
We will run time evaluation for 01.11.2013 using TCode PT60 as shown below:
The time evaluation run is successful.
Below is the processing of function QUOTA.
The contracted annual leave got generated in IT2006 with the below details:
- Validity Interval: 01.11.2013 – 30.04.2014
- Deduction Interval: 01.11.2013 – 30.04.2014
- Quota Number: 9.91699 Days
So what happens if the contract gets renewed? Let us assume the contract gets renewed for the period 01.05.2014 to 31.08.2014. In such a scenario, we modify IT0041 as shown below:
This will ensure that a new quota gets generated on 01.05.2014.
Here, I come to the end of this knowledge artifact. Thanks for your patience to go through it. I discovered a new way of granting prorated absence quota in time evaluation because of this requirement.
I hope this has been beneficial for you too.
You can also refer to other knowledge artifacts created by me at the below link: