Date Dependent PCR Processing in Time Evaluation
Introduction
One of the things that fascinated me when I started working in time management was Date Dependent PCR Processing in Time Evaluation.
Over a period of time, I realized that there are two possible ways (there may be more ways also) to achieve date dependent PCR processing in time evaluation. In this knowledge artifact, I will explain both the methods and the scenarios in which these methods can be used.
Method 1: Based on Payroll Parameter Constant
Let us refer to the PCR ZAR1 shown in the below screenshot. When this PCR gets processed in time evaluation, it sets a value of 0.5 hours using operation HRS=0.5 and then adds 0.5 hours to daily time type ZAR1 using operation ADDDBZAR1.
Let us assume that this PCR has been getting processed in time evaluation ever since time evaluation go live (let’s say year 2012). Now, your client comes up with a requirement that effective 01-Jan-14, the no. of hours to be added to time type ZAR1 should be increased from 0.5 to 1.
We can’t change HRS=0.5 to HRS=1.0 directly because if there is a retro time evaluation before 01-Jan-14, the time type value will get changed from 0.5 to 1.0 for dates prior to 01-Jan-14. This will be incorrect.
To bring in the date dependent functionality, we will create a custom constant in Table V_T511K. Let us create a custom constant ZCONS in Table V_T511K as shown below.
We will keep the value of the constant as 0.00 from 01.01.1900 till 31.12.2013 and 1.00 from 01.01.2014 till 31.12.9999.
Let us now modify our PCR ZAR1 as shown below.
When this PCR gets processed now, it sets the value of the constant ZCONS from Table V_T511K in operation HRS based on the date for which time evaluation is happening.
Let us say that the time evaluation run is happening for 31-Dec-13. The value of constant ZCONS is 0.0 on 31-Dec-13. The hours in operation HRS (0.0) is compared with 0 using HRS?0. Since the comparison value is equal to 0, the PCR gets processed under = and the no. of hours are again set to 0.5 using HRS=0.5. Then these hours (0.5) are added to time type ZAR1.
When the time evaluation run is happening for 01-Jan-14, the value of constant is 1.0 on 31-Dec-13. The hours in operation HRS (1.0) is compared with 0 using HRS?0. Since the comparison value is not equal to 0, the PCR gets processed under * and the no. of hours are set to 1.0 using HRS=1.0. Then these hours (1.0) are added to time type ZAR1.
Let us assume that the client comes back saying that from 01-Feb-2014, they would like to add 1.5 hours to time type ZAR1. We can again modify the constant and PCR as shown below to achieve this requirement.
This method of date dependent PCR processing is recommended in the below scenarios:
- The changes impact a group of employees and not just one employee.
- Using one constant, you can build a no. of validations for time dependent processing.
Let us move now to the second method of date dependent PCR processing.
Method 2: Based on Date Specification
Let us refer to the PCR ZAR2 shown in the below screenshot. When this PCR gets processed in time evaluation, it sets a value of 0.5 hours using operation HRS=0.5 and then adds 0.5 hours to daily time type ZAR2 using operation ADDDBZAR2.
Let us assume that this PCR has been getting processed in time evaluation ever since time evaluation go live (let’s say year 2012). Now, your client comes up with a requirement that effective 01-Jan-14, the no. of hours to be added to time type ZAR1 should be increased from 0.5 to 1 because the employee is completing his TE anniversary.
To bring in the date dependent functionality, we will use a date type in date specification infotype as shown below:
The PCR ZAR2 will be modified as shown below:
The operation HRS=YDAAD5 refers to date specification and finds the difference between date of time evaluation and date mentioned in date type D5. On 31-Dec-13, the difference will be less than 0 and hence, the PCR will get processed under <. The no. of hours are set to 0.5 using HRS=0.5. Then these hours (0.5) are added to time type ZAR2.
On 01-Jan-14, the difference will be equal to 0 and hence, the PCR will get processed under *. The no. of hours are set to 1.0 using HRS=1.0. Then these hours (1.0) are added to time type ZAR2.
By now, you would have guessed that this method of date dependent PCR processing in time evaluation is employee specific. Also, you can build only one check using one date type. If you want a different processing from 01-Feb-2014 in the same PCR ZAR2, you will require another date type in this method.
Below is a comparison of the two methods of date dependent PCR processing in time evaluation:
Comparison: Date Dependent PCR Processing in Time Evaluation |
|
Constant Method |
Date Type Method |
Recommended for a group of employees. |
Recommended for employee specific processing. |
One constant can be used for multiple date checks in PCR processing. |
One date type can be used for only one date check in PCR processing. |
Here, I come to the end of this knowledge artifact.
Thank you for your patience to go through this document. I hope this has been beneficial for you.
Warm regards,
Vivek Barnwal.
**************************************************************************************************
You can also refer to other knowledge artifacts created by me at the below link:
One Stop Shop of my Knowledge Artifacts in SAP HCM
Good one!!
Keep going.... 🙂
Thanks Rajesh...
Hi,
Thanks for sharing this document.
I have a question regarding the first method:
Why "coding" the different hours variants in the operation instead of using the value of constant ZCONS itself?
If you are referring to to HRS = 0.5 or HRS = 1.0, I just used them for demonstration purposes. Ideal way to do this will be to use a constant and make it date dependent.
Hi vivek,
I have a almost similar requirement like this. i hope you would help me here.we have been calculating seniority based on hirng date in 0000, but suddenly they asked me to go with working date date type we maintain it in IT0041, depend upon that calculation will happen, is that possible Vivek with our date type?
Will proration work?
your inputs is much appreciated.
thanks
Sri
Can you please post this as a question in a thread so that every SCN SAP HCM consultant can look into it?
Please send me the link when you post your question there. This is not a good practice to post question here.
Regards,
Vivek Barnwal
Hi Vivek.
Sorry for that. i have already put that question
this is my thread Absence Quota Issue
Thanks
Sriram
HI Vivek,
Nice explanation keep posting.
Good luck.
Thanks...
Hi Vivek,
Good approach on method 1 using constants table. Second method is pretty straight forward and HRS operation documentation gives some examples on it.
Anyhow good post.
Thanks,
Hemanth Jamithi.
Thanks...
Informative article
Thanks Surya...
Regards,
Vivek
Dear Vivek you are such a genius!The method is brilliant.
However I'm thinking if it's possible to do some PCR like TD10, using HRS to get exact time to compare...
Thanks Alina.
Didn't get your requirement related to TD10. You can log a new thread regarding your query.
Regards,
Vivek Barnwal
Dear Vivek,
Because in certain case one constant may not enough for using. So in our company we use HRS=B**** plus IF...ELSE..ENDIF function to let system know it's date dependent. Like PCR TD10 does.
For example, in time evaluation, before Mar 2015 PCR goes to one way, after 1st Mar 2015 the rule goes to another way.
*
****
HRS=BCURYR Set
HRS?2015 Decision op. HRS
<
SCOND=F IF If condition false
=
HRS=BCURMC Set
HRS?3 Decision op. HRS
<
SCOND=F IF If condition false
=
SCOND=T IF If condition true
>
SCOND=T IF If condition true
>
HRS=BCURMC Set
HRS?3 Decision op. HRS
<
SCOND=F IF If condition false
=
SCOND=T IF If condition true
>
SCOND=T IF If condition true
And in payroll we use COMPER.
Hi Alina,
Yes, we can also use the above method given by you. Or we can create multiple constants too.
Thanks and regards,
Vivek Barnwal
Hi Elina, and everyone
Further thoughts about date check:
1. In PT schema, you can still use for your requirement of time evaluation processing from a certain date to be different, the method of checking a constant in V_T511K for a value or more. Also this concept can be extended for a second change on a later date, by delimiting the constant again on the new date and setting the value to say 2 as compared to the previous values being zero & 1.
Examples
A. For the first change say from Mar 10 2014
A.1 in TE schema say ZM04, following lines can be used:
IF ZXXX ARE XXX CHANGES EFFECTIVE?
PZL ZYY1 GEN * -YES; USE NEW RULES
...
...
ELSE -NO; USE OLD RULES
PZL ZYYY GEN *
...
...
ENDIF
A.2 PCR ZXXX
D HRS=CZCONS HRS?0
* SCOND=T
< SCOND=F
A.3 constant ZCONS values 0 from 01.01.1900 to 12.31.9999 delimited on May 10 2014; from this date value 1.
B. For the second change say from Jan 5 2015
B.1 in TE schema say ZM04, following lines can be used:
IF ZXX2 ARE XX2 CHANGES EFFECTIVE?
PZL ZYY2 GEN * -YES; USE NEW RULES from Jan 15, 2015
...
...
ELSE
IF ZXXX ARE XXX CHANGES EFFECTIVE?
PZL ZYY1 GEN * -YES; USE NEW RULES from Mar 10, 2014
...
...
ELSE
PZL ZYYY GEN * -NO; USE OLD RULES
...
...
ENDIF
B.2 a new PCR ZXX2 similar to ZXXX
D HRS=CZCONS HRS?1
* SCOND=T
< SCOND=F
B.3 constant ZCONS values 0 from 01.01.1900 to 12.31.9999 delimited on May 10 2014; from this date value 1, again delimited from Jan 15, 2015 with value 2.
2. Further, in time schema, I have designed and developed a time operation to check variables as an adaptation of HRS to check other types of variables and system data. One such case was to check current pay period and pass it in hrs field, then it was used to check the current pay period is more or less than the effective pay period.
3. CMPER can be used to check the current in-period. This operation however has no check for for-period. One way to do this is below (see SAP PCR QRND)
It uses NUM operation as below to return pay period inm NUM field
NUM=YCURPP to return current for-period period
NUM=YCURYY to return current for-period year
NUM=YINPPP to return current in-period period
NUM=YINPYY to return current in-period year
However it has been posted earlier on this site that during off-cycle pay runs, the operation NUM=YCURPP returns zero. This needs to be checked further.
4. Use of table PN:
The table PN which is available during payroll run, holds data about the pay period.
Following obtains the current in-period's start date. This can be used to check the effective date.
TABLEPN NUM=BBEGDA
Hope this helps further.