Enterprise Resource Planning Blogs by Members
Gain new perspectives and knowledge about enterprise resource planning in blog posts from community members. Share your own comments and ERP insights today!
cancel
Showing results for 
Search instead for 
Did you mean: 
vianshu
Active Contributor

Client Requirements

The client would like to report on employees who come late or leave early and also report on unauthorized absence. This is required for working days as well as for attendance on public holidays and OFF days.


There are only 2 shifts – day shift and night shift - in the plant and an employee can work during one of the shifts. All working days of each shift have the same planned start time and planned end time.


When an employee is working on a public holiday and the daily work schedule is not OFF, then the start time and end time of the daily work schedule will be used to determine if the employee has come late or left early. If an employee works on OFF day or on public holiday, it will be counted as overtime.


When the employee is working on a day with daily work schedule as OFF, the planned start time and planned end time can differ. Hence, on some OFF days, the planned start time and planned end time can be 08:15 and 17:45 respectively and on some days, they can be 09:00 and 13:30 respectively.


Below are the conditions for late coming, early going and unauthorized absence.


  • 0 min < {Clock In Time – Planned Start Time} < 60 min    =>     Late Coming
  • 60 min =< {Clock In Time – Planned Start Time}             =>     May be an unauthorized absence. The time administrator/ supervisor will determine whether there is a need for unauthorized absence or not.
  • 0 min < {Planned End Time – Clock Out Time} < 60 min    =>     Early Going
  • 60 min =< {Planned End Time – Clock Out Time}             =>     May be an unauthorized absence. The time administrator/ supervisor will determine whether there is a need for unauthorized absence or not.

If clock in and clock out times are both missing on a working day, then the time administrator/supervisor must get informed about the employee not being at work. The time administrator/ supervisor will determine the cause of absence and then accordingly apply for unauthorized absence if needed.


Solution Design

The solution on late coming, early going and unauthorized absence can be achieved based on custom time types and PCRs.


I will create five time types as below:


  • ZVB7 – This time type will get generated if the employee is late by more than 0 min but less than 60 min when compared to shift start time. The time type will contain the decimalized min.



  • ZVB8 – This time type will get generated if the employee leaves early by more than 0 min but less than 60 min when compared to shift end time. The time type will contain the decimalized min.

                                                                                                                    

  • ZVB9 – This time type will get generated if the employee comes to office more than 60 min late than the shift start time. This may bring following possibilities:


    • Employee is actually late by more than 60 min
    • Employee is on leave during the first half of the shift (IT2001 record)
    • Employee is in workshop at some other location during the first half (IT2002 record)

Hence, it is advisable that the system generates a time type with the decimalized time and a system message to the time administrator where he can take a judicious decision of handling this. If the employee is actually late by more than or equal to 60 min, then the time administrator will apply unauthorized leave for the duration in the system.

  • ZVB0 – This time type will get generated if the employee leaves office early by more than 60 min than the shift end time. This may bring following possibilities:


    • Employee actually left early by more than 60 min
    • Employee is on leave during the second half of the shift (IT2001 record)
    • Employee is in workshop at some other location during the second half (IT2002 record)

Hence, it is advisable that the system generates a time type with the decimalized time and a system message to the time administrator where he can take a judicious decision of handling this. If the employee actually left early by more than or equal to 60 min, then the time administrator will apply unauthorized leave for the duration in the system.

  • ZVBA – This monthly time type will get generated from unauthorized absence type 0150 through a custom PCR.


The next step is to find a way to apply planned start time and planned end time for days with daily work schedule as OFF. But before we decide this, let us go through the WSRs for the two shifts that the client has.


WSR 3/US/10 D0001-01 – This WSR uses PWS D001 and it is a 5D2X (5 working days 2 OFF days) PWS with DWS as D001 and OFF.

V_T508A


V_T551A


T550A


WSR 3/US/10 N0001-01 – This WSR uses PWS N001 and it is a 5N2X (5 working days 2 OFF days) PWS with DWS as N001 and OFF.

V_T508A


V_T551A

T550A


Now, we are going to create constants in Table V_T511K to specify planned start time and planned end time for OFF days for each WSR.

V_T511K


Since these constants are date dependent, we can change the planned start time and planned end time on any particular OFF day by using delimitation functionality.


The first two constants will be considered for WSR D0001-01 when the employee works on OFF day. The next two constants will be considered for WSR N0001-01 when the employee works on OFF Day.


In this way, we need to define two constants for every WSR to be used in the plant to denote start time and end time of shift on OFF days.

Now we are going to define system messages which will get generated if the employee’s “clock in” is late by more than and equal to an hour compared to planned start time or if the employee’s “clock out” is early by more than and equal to an hour compared to planned end time. These messages can be accessed by time administrator through TCode PT_ERL00 or through PTMW.

V_T555E


The next step is to create a PCR which will generate time types and system messages. This is a very big PCR and hence, I will explain the logic in parts.

PCR ZVB1 Screenshot A



In PCR ZVB1 Screenshot A, we first determine whether the planned working hours is 0 or not using VARSTFREE. If it is not, it goes for processing at N and then if we check the day type of the day using VARSTDAYTY.


If the day type is *, the time pair is moved to output table using COLOP *. In the current scenario, only day types 0 and 1 are being used by client.


If the day type is 0, then we check if start and end times exist in the time pair or not using OUTTPEXTIM. If any of the start or end time is missing, the time pair gets processed through N and moves to output table using COLOP *. This time pair will later cause time evaluation to fail in PCR TE30 since either the clock in or clock out is missing.


If the start time and end time exist in the time pair, then it gets processed under Y and further processing happens under employee subgroup grouping specification A and B for PCR ZVB1 using PCY ZVB1A and PCY ZVB1B.


If the day type is 1, the processing is same as day type 0.

PCR ZVB1 Screenshot B


If the planned working hours is 0 (meaning DWS is OFF), the processing happens under Y (PCR ZVB1 Screenshot B). We check whether time pair has start and end times or not using OUTTPEXTIM.


If the start and end times don’t exist, then the time pair is processed under N and it is moved to output table using COLOP *.


If the start and end times do exist, the processing happens under Y and further processing happens under employee subgroup grouping specification C for PCR ZVB1 using PCY ZVB1C.


Under employee subgroup grouping A for PCR ZVB1, the “clock in” time of the time pair is read using HRS=PBEG. Then the planned start time of the shift is subtracted from “clock in” time using HRS-SWTB. The result is compared with 0 using HRS?0 and if it is less than and equal to 0, the time pair gets processed under * and is moved to output table using COLOP *.

If the result is greater than 0, then it is compared with 1 using HRS?1. If the result is less than 1, it gets processed under < and the result is added to time type ZVB7 using ADDDBZVB7 and the time type is moved to output table using COLOP *.


If the result is equal to or greater than 1, then the time pair gets processed under * and the result is added to time type ZVB9 using ADDDBZVB9, a message Z1 – “Employee came late > 1hr” gets generated in time evaluation and the time pair is moved to output table using COLOP *.

PCR ZVB1 Screenshot C

Under employee subgroup grouping B for PCR ZVB1, the planned end time of the shift is read using HRS=SWTE. Then the “clock out” time of the shift is subtracted from planned end time of the shift using HRS-PEND. The result is compared with 0 using HRS?0 and if it is less than and equal to 0, the time pair gets processed under * and is moved to output table using COLOP *.


If the result is greater than 0, then it is compared with 1 using HRS?1. If the result is less than 1, it gets processed under < and the result is added to time type ZVB8 using ADDDBZVB8 and the time type is moved to output table using COLOP *.


If the result is equal to or greater than 1, then the time pair gets processed under * and the result is added to time type ZVB0 using ADDDBZVB0, a message Z2 – “Employee left early > 1hr” gets generated in time evaluation and the time pair is moved to output table using COLOP *.


The time pair comes for processing under employee subgroup grouping C of PCR ZVB1 when the time pair has start and end times on an OFF day. The work schedule rule of the employee is read using OUTWPSHIFT.


If the WSR of the employee is D0001-01, the time pair gets processed under D0001-01. Further processing happens under employee subgroup grouping D & E using PCY ZVB1D and ZVB1E.


If the WSR of the employee is N0001-01, the time pair gets processed under N0001-01. Further processing happens under employee subgroup grouping F & G using PCY ZVB1F and ZVB1G.


If the WSR is other than D0001-01 and N0001-01, the processing happens under ******** and the time pair is moved to output table using COLOP *. This means that the late coming and early going time types won’t get generated in this case.

PCR ZVB1 Screenshot D

The time pair comes for processing under employee subgroup grouping D for WSR D0001-01 when start and end times exist in time pair for OFF day.


The “clock in” time of the time pair is read using HRS=PBEG. Then the planned start time of OFF day is subtracted from “clock in” time using HRS-CZD01B (The constant ZD01B is read from Table V_T511K). The result is compared with 0 using HRS?0 and if it is less than and equal to 0, the time pair gets processed under * and is moved to output table using COLOP *.


If the result is greater than 0, then it is compared with 1 using HRS?1. If the result is less than 1, it gets processed under < and the result is added to time type ZVB7 using ADDDBZVB7 and the time type is moved to output table using COLOP *.


If the result is equal to or greater than 1, then the time pair gets processed under * and the result is added to time type ZVB9 using ADDDBZVB9, a message Z1 – “Employee came late > 1hr” gets generated in time evaluation and the time pair is moved to output table using COLOP *.

PCR ZVB1 Screenshot E


The time pair comes for processing under employee subgroup grouping E for WSR D0001-01 when start and end times exist in time pair for OFF day.


The planned end time on OFF day is read using HRS=CZD01E (Constant ZD01E is read from Table V_T511K. Then the “clock out” time of the shift is subtracted from planned end time of the shift using HRS-PEND. The result is compared with 0 using HRS?0 and if it is less than and equal to 0, the time pair gets processed under * and is moved to output table using COLOP *.


If the result is greater than 0, then it is compared with 1 using HRS?1. If the result is less than 1, it gets processed under < and the result is added to time type ZVB8 using ADDDBZVB8 and the time type is moved to output table using COLOP *.


If the result is equal to or greater than 1, then the time pair gets processed under * and the result is added to time type ZVB0 using ADDDBZVB0, a message Z2 – “Employee left early > 1hr” gets generated in time evaluation and the time pair is moved to output table using COLOP *.

PCR ZVB1 Screenshot F

The time pair comes for processing under employee subgroup grouping F for WSR N0001-01 when start and end times exist in time pair for OFF day.


The “clock in” time of the time pair is read using HRS=PBEG. Then the planned start time of OFF day is subtracted from “clock in” time using HRS-CZN01B (The constant ZN01B is read from Table V_T511K). The result is compared with 0 using HRS?0 and if it is less than and equal to 0, the time pair gets processed under * and is moved to output table using COLOP *.


If the result is greater than 0, then it is compared with 1 using HRS?1. If the result is less than 1, it gets processed under < and the result is added to time type ZVB7 using ADDDBZVB7 and the time type is moved to output table using COLOP *.


If the result is equal to or greater than 1, then the time pair gets processed under * and the result is added to time type ZVB9 using ADDDBZVB9, a message Z1 – “Employee came late > 1hr” gets generated in time evaluation and the time pair is moved to output table using COLOP *.

PCR ZVB1 Screenshot G

The time pair comes for processing under employee subgroup grouping G for WSR N0001-01 when start and end times exist in time pair for OFF day.


The planned end time on OFF day is read using HRS=CZN01E (Constant ZN01E is read from Table V_T511K. Then the “clock out” time of the shift is subtracted from planned end time of the shift using HRS-PEND. The result is compared with 0 using HRS?0 and if it is less than and equal to 0, the time pair gets processed under * and is moved to output table using COLOP *.


If the result is greater than 0, then it is compared with 1 using HRS?1. If the result is less than 1, it gets processed under < and the result is added to time type ZVB8 using ADDDBZVB8 and the time type is moved to output table using COLOP *.


If the result is equal to or greater than 1, then the time pair gets processed under * and the result is added to time type ZVB0 using ADDDBZVB0, a message Z2 – “Employee left early > 1hr” gets generated in time evaluation and the time pair is moved to output table using COLOP *.

If a new WSR is being defined in the plant, then we must incorporate this WSR in the PCR ZVB1 at the point highlighted below. We should also define the constants for the WSR shift start and end times for OFF day. Also, the processing under D and E in PCR ZVB1 for existing WSR D0001-01 should be copied to the new ones and the constants of WSR D0001-01 are replaced by constants of new WSR.


PCR ZVB1 Screenshot H

An unauthorized absence 0150 is also created.


Table T554S

The time evaluation class of this absence type is maintained as 10. This has been done because all absences captured currently get a time type 0220 assigned to absence time pair through table V_T555Z using function TIMTP.


We would like to have a custom time type ZVBA – unauthorized absence assigned to absence type – unauthorized absence. This is done using PCR ZVB2.


V_554S_E

PCR ZVB2

This PCR helps to assign a unique time type ZVBA for unauthorized absence captured in IT2001. The PCR reads the pair type of the time pair using OUTTPPTYPE. If the pair type is anything other than 2, the time pair gets processed under * and it moves to output table using COLOP *.


If the pair type is 2, the time pair gets processed under 2 and the class for time evaluation for the absence captured on the particular day is read using VARABCAT. If the class is anything other than 10 (means absence captured is not unauthorized absence), the time pair moves to output table using COLOP *.


If the pair type is 10, the time pair gets processed under 10 and the no. of hours of unauthorized absence is added to time type ZVBA using ADDDBZVBA and the time pair is moved to output table using COLOP *.


The next step is to include both the PCRs in custom time schema ZTCN. The time schema ZTCN is a copy of time schema TM00 – Time Evaluation with Personnel Time Events.

Schema ZTCN

PCR ZVB1 is being processed by function RTIP because TIP table is being read in this PCR. Par 2 is GEN because it is called for all time types.


PCR ZVB2 is being processed by function RTIPA because TIP table is being read in this PCR only in case of absence on this day. Par 2 is GEN because it is called for all time types.


Let us now move towards testing this solution design.


I could think of 18 different scenarios and I tested them and all of them successfully passed.


IT0007

Work Schedule

Please note the below:


  • 01-Jan-12 has DWS as OFF and is also a public holiday
  • 02-Jan-12 has DWS as D001 and is also a public holiday
  • 03-Jan-12 has DWS as D001 and is not a public holiday

Scenario 1: No time type generation if the employee neither comes late nor leaves early on a working day

Scenario 2: No time type generation if the employee neither comes late nor leaves early on a public holiday

Scenario 3: No time type generation if the employee neither comes late nor leaves early on a off day

IT2011

Time Evaluation Result – It is successful and doesn’t generate any time types.


                                                                                                                  

01-Jan-12 – Late coming, early going time types don’t get generated

02-Jan-12 – Late coming, early going time types don’t get generated

03-Jan-12 – Late coming, early going time types don’t get generated

Scenario 1: Pass


Scenario 2: Pass


Scenario 3: Pass

-------------------------------------------------------------------------------------------------------------------------------------------------------------

Scenario 4: Employee came late by more than 0 min but less than 60 min on a working day


Scenario 5: Employee went early by more than 0 min but less than 60 min on a working day


Scenario 6: Employee came late by more than 0 min but less than 60 min on a public holiday


Scenario 7: Employee went early by more than 0 min but less than 60 min on a public holiday


Scenario 8: Employee came late by more than 0 min but less than 60 min on an off day


Scenario 9: Employee went early by more than 0 min but less than 60 min on an off day

IT2011

Time Evaluation Result – It is successful and generates early going and late coming time types.

01-Jan-12

02-Jan-12

03-Jan-13


RPTBAL00 Report – This report will display the late coming, early going and unauthorized absence for an employee.


RPTBAL00 Report Output


Scenario 4: Pass


Scenario 5: Pass


Scenario 6: Pass


Scenario 7: Pass


Scenario 8: Pass


Scenario 9: Pass

-------------------------------------------------------------------------------------------------------------------------------------------------

Scenario 10: Employee came late by more than 60 min on a working day


Scenario 11: Employee went early by more than 60 min on a working day


Scenario 12: Employee came late by more than 60 min on a public holiday


Scenario 13: Employee went early by more than 60 min on a public holiday


Scenario 14: Employee came late by more than 60 min on an off day


Scenario 15: Employee went early by more than 60 min on an off day

IT2011

Time Evaluation – It is successful and generates late coming and early going time types and messages of being late or leaving early by more than an hour. These messages can also be read in PTMW or TCode PT_ERL00.

01-Jan-12

02-Jan-12

03-Jan-12

RPTBAL00 Report

RPTBAL00 Report Output


There are no existing absences or attendances for the first half or second half for the period 01-Jan-12 to 03-Jan-12. This means that the employee actually came late (> 1hr) and went early (>1 hr) on these days. We can’t capture any unauthorized absence on 01-Jan-12 and 02-Jan-12 as they are non-working days due to being OFF day and public holiday.


The unauthorized absence will be captured only for 03-Jan-12.


IT2001

Once the time evaluation rerun happens because of capture of unauthorized absence, the time type ZVBA gets generated.

Report RPTBAL00 Output


A variant of the report RPTBAL00 can be developed to display data related to the below time types only:


  • ZVB7   -       Late Coming
  • ZVB8   -       Early Going
  • ZVBA  -        Unauthorized Absence

Scenario 10: Pass


Scenario 11: Pass


Scenario 12: Pass


Scenario 13: Pass


Scenario 14: Pass


Scenario 15: Pass

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Scenario 16: Employee didn’t turn up on a working day


Scenario 17: Employee didn’t turn up on a public holiday


Scenario 18: Employee didn’t turn up on an off day

IT2011

Time Evaluation – No message gets generated for 01-Jan-12 (OFF and public holiday) and 02-Jan-12 (public holiday) because they are non-working days and no attendance or time events have been captured for these days.


The time evaluation fails for 03-Jan-12 since there is no leave or attendance captured and time events are missing too. The message will go to time administrator in PTMW or can also be accessed using TCode PT_ERL00.

Unauthorized absence is captured in IT2001 since the employee was not at work and also didn’t have any pre-approved absence or attendance captured for 03-Jan-12.


IT2001

Time Evaluation – It runs successfully after absence is captured.

P2001

Table TES

RPTBAL00 Report


RPTBAL00 Report Output


Scenario 16: Pass


Scenario 17: Pass


Scenario 18: Pass

-------------------------------------------------------------------------------------------------------------------------------------------------------------

Here I come to the end of this knowledge artifact. I hope you enjoyed reading through this document.

If you liked this document and found it to be beneficial, request you to please kindly rate it for the benefit of other users.

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


54 Comments
Labels in this area