Overview
This blog post will provide an overview on building a time type which is independent from the work schedule assigned to the employee.
A time type which can exclude weekends and public holidays.
As per the current available SuccessFactors features, certain limitations are restricting in developing a time type which counts only weekdays excluding the weekends and public holidays. This should work irrespective of the work schedule.
Problem
Example:
If employees work schedule is 15 days working and 15 days off.
With available feature we would go with creation of time type with below parameters:
Duration Display According To = ‘Deduction Quantity’
Counting Method = Custom (this will exclude weekend and holidays)
Requesting on Non-Working Days Allowed = Yes
This would work fine in case if there are no absence validation rules.
As soon as we use an absence validation rules, where the time type should not be able to request time off less that 4 days. The rules behavior does not satisfy our requirement.
Example:
If employee applies for leave from Monday to Sunday on a Non-Working day, the validation rule fails.
Reason: when we submit the leave request in the non-working days as per work schedule.
The
EmployeeTime.NumberOfDays returns
Zero instead of the number of days we selected in leave request. (when
Requesting on Non-Working Days Allowed = No)
The
EmployeeTime.NumberOfDays returns
7 instead of just weekdays. (when
Requesting on Non-Working Days Allowed = Yes)
Hence the validation fails.
If we use rule function
GetNumberOfCalendarDaysForPeriod() this return all days including weekends between start date and end date and there is no function to subtract weekends.
The available rule functions either return zero, work schedule days or calendar days.
Also we do not have the flexibility to SET
EmployeeTime.NumberOfDays using the business rule.
Another limitation is, the 'deduction quantity' and 'counting method' cannot be used for time types without posting rules.
What is a way to achieve this requirement until SuccessFactors releases a standard solution?
- FOR TIME TYPE WITH POSTING RULES
Create Time type with below parameters-
Duration Display According To = ‘Deduction Quantity’
Counting Method = Custom (this will exclude weekend and holidays)
Requesting on Non-Working Days Allowed = Yes
Posting Priority = Post to time accounts by posting rules only
How to build a rule?
Assume, if we want to apply a rule where employee cannot request this time type for less than or equal 4 days.
The normal rule will fetch
employeetime.numberofdays =
all calendar days(including public holidays) since we have enabled requesting on non-working days.
If it was disabled,
employeetime.NumberOfDays will return
Zero.
Hence, we need to find a way to overcome this restriction.
Below is the way I did it.
I decided to use the below logic in rule.
If
NumberOfCalendarDaysForPeriod - (NumberOfHolidaysForPeriod + NumberOfWeekendsForPeriod ) <= 4 days
SuccessFactors has already provided us with function NumberOfCalendarDaysForPeriod() and NumberOfHolidaysForPeriod() but there is no function to count the number of weekends.
Therefore, I developed a lookup object
WeekendCountLookUp table which counts number of weekends between a period.
For this it required 3 columns.
DayOfWeek
NumberOfCalendarDays
NumberOfWeekends
Day of week is to find out which day of the week the start date of request falls. Based on that primary parameter and
number of calendar days, we could count the number of weekends between that period.
Below is the sample of table entry for when Start date falls on Monday i.e. DayOfWeek = 1.
*Find the complete import file of lookup object for the upload here.
Similarly, we would import entry for all DayOfWeek from Monday to Sunday for 365 days.
Therefore the table will have 365*7 = 2555 entries.
Finally, the rule will be
Now the above method will help us for the time type having posting rules.
2. FOR TIME TYPE WITH POSTING RULES
In this case, we must create a new dummy time account type.
I created a time account type named
OTHER (Other Leaves)
The accrual will always be zero for this time account and keep the
Balance Cannot Fall Below as -50 or -100 or -200 as per the requirements up to you.
Assign this time account type in to the time types in posting rules.
Now use the same logic as the one used for time types with posting rules as explained above.
Conclusion
Please highlight if you find any flaw or loophole in the above solution.
Also please vote the below improvement idea in case you believe a standard solution is required for this problem.
https://influence.sap.com/sap/ino/#/idea/235049
Thank you. Have a Good day.