Skip to Content

I. Requirement


How to calculate consecutive 7 days for absence in Time Evaluation? If employee is on leave consecutive 7 days, system raise an information message.

First of all, you have to make clear the requirement whether it’s CALENDAR days or WORKING DAYS. Because it will impact how to design the enhancement in Time Eval.


In the document, I will demonstrate 2 solutions to handle each above requirement: CALENDAR and WORKING DAYS. And I only focus on 1 absence type 1211, you can adjust accordingly with your current configuration.


II. Master Data


My employee has the planned working time in IT7 as below, it is simple ws: working on Mon to Fri ; off on SAT to Sun.

/wp-content/uploads/2015/09/1_783480.jpg

III.(A) SOLUTION 1 for CALENDAR


The tricky part when calculating by calendar day is that the standard P2001 function will not generate any record in TIP table if the date is DAY OFF. In order to overcome the situation, we have to use AB with function ACTION while calling pcr /VN1 in time schema.


1) I create one Time Type to hold each day on leave and accumulate accordingly as well.

/wp-content/uploads/2015/09/1_1_783522.jpg

(2) The 1st pcr: if absence type is 1211, assign 1 into Time Type ZABS

/wp-content/uploads/2015/09/2_783485.jpg

(3) The 2nd pcr: if Time Type ZABS > 0 (it means that employee is on leave on that date), so plus with all total consecutive leave until the previous date (HRS+LZABS).

/wp-content/uploads/2015/09/4_783524.jpg

(4) Insert into Time schema: I copies standard one TM04 and add more 2 lines just immediately after block Provide time data in row 350.

/wp-content/uploads/2015/09/5_783525.jpg

The AB above (part 2) with function ACTIO will help us to check whether employee is on leave on DAY OFF or not. Without AB, SAP will only check employee is on leave on DAY WORK only.


III.(B) Testing SOLUTION 1 for CALENDAR


TC01:

INPUT Employee is on-leave from 26.08.2015 to 03.09.2015. Expected result is that system should raise message on 01.09.2015.

/wp-content/uploads/2015/09/6_783526.jpg

OUTPUT: The 2nd pcr /VN9 generated the information message on 01.09.2015 as expected.

/wp-content/uploads/2015/09/7_783533.jpg

Run standard report with period from 25.08.2015 to 30.09.2015: output is expected.

/wp-content/uploads/2015/09/8_783534.jpg

Time Type ZBAS in Time cluster result: We can easily see that system is capable to accumulate consecutive CALENDAR days from 28.08.2015 to 01.09.2015.

/wp-content/uploads/2015/09/9_783535.jpg

TC02:

INPUT: Employee is on-leave from 26.08.2015 to 29.08.2015 and 31.08.2015 to 03.09.15. (No leave is on date 30.08.2015)

Expected result is that system should NOT raise any message.

/wp-content/uploads/2015/09/10_783537.jpg

OUTPUT: system DOES NOT generate message any more.
/wp-content/uploads/2015/09/11_783538.jpg

Time Type ZABS in time cluster result.

System is smart enough to re-start counting from 31.08.2015 as there is no absence record on 30.08.2015. Therefore, system does NOT generate the message anymore.

/wp-content/uploads/2015/09/12_783539.jpg


IV.(A) SOLUTION 2 for WORKING DAY

The tricky part when calculating by working day is how to ensure that on Mon we can able to check that the previous Fri employee is on leave. The logic in /VNA will handle it.

(1) Time Type ZABS keep as the same.


(2) 1st prc not change: /VN1, but the way to call in schema will be changed.


(3) 2nd pcr /VNA: It is quite the same pcr /ZVN9 above but having additional condition on DAY OFF (VARSTFREE is Y) is to carry previous value from the previous working day (e.g. Fri) on DAY OFF such as Sat and Sun. So the next working day (Mon), we can ensure that employee was on leave on last Fri.

/wp-content/uploads/2015/09/13_783540.jpg

(4) Calling the 2 pcr in time schema:

/wp-content/uploads/2015/09/14_783541.jpg

IV.(B) Testing SOLUTION 2 for WORKING DAY


TC03:

INPUT: Employee is on-leave from 26.08.2015 to 29.08.2015 and 31.08.2015 to 03.09.2015. (Same input in TC02 above)

Expected result is that system should raise the information message on 03.09.2015

/wp-content/uploads/2015/09/15_783548.jpg


OUTPUT:

The 2nd pcr /VNA generated the information message on 03.09.2015 as expected.

/wp-content/uploads/2015/09/17_783550.jpg


Run standard report with period from 25.08.2015 to 30.09.2015: output is expected.

/wp-content/uploads/2015/09/16_783549.jpg

Time Type ZABS on Sat and Sun, it’s 3 days as we automatically carry forward from Fri (value 3 days) to DAY OFF on Sat and Sun.

/wp-content/uploads/2015/09/18_783554.jpg

TC04:

INPUT: Employee is on-leave from 24.08.2015 to 27.08.2015 and 31.08.2015 to 03.09.2015.

Expected result is that system should NOT raise the information message.

/wp-content/uploads/2015/09/19_783555.jpg

OUTPUT:

System does NOT generate any message anymore because time type ZABS has not reached 7 consecutive days yet.

We can see that system accumulate from 24.08.2015 to 27.08.2015 as 4 days. But Fri 28.08 does NOT have any absence, so system reset the counting and restart again from next Mon on 31.08.2015.

/wp-content/uploads/2015/09/20_783556.jpg

V. CONCLUSION


With 2 different approaches, we are able to handle both requirement: consecutive CALENDAR DAYS / WORKING DAYS on leave. Hope you can apply the document for the various scenarios. Thanks.

Best Regards,

Woody

To report this post you need to login first.

3 Comments

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

Leave a Reply