SAP Knowledge Base Article - Public

3656773 - Business Rule – How to Validate Employee Consecutive Working Days

Symptom

There is a business requirement that employees must not work for more than a specified number of consecutive days. In this scenario, a validation rule can be implemented to trigger an error once the consecutive working days exceed the defined limit. 

The validation rule can validate not only data within the same time sheet period, but also consecutive days that span across time sheet periods. Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental. 

Environment

  • SAP SuccessFactors HCM Suite
  • SAP SuccessFactors Employee Central - Time Sheet
  • SAP SuccessFactors Time Tracking

Resolution

Prerequisites:

For the legacy week time sheet, the business requirement can be achieved by setting up a MDF validation rule under Employee Time Sheet Entry object.

Note: For flexible approval period time sheets based on new data model, please configure the rule under the Time Recording object instead of Employee Time Sheet Entry with similar validation logic. 

Configuration Example:

The example below demonstrates how to prevent employees from recording 3 consecutive days with attendance time type BLUE_22DAYs. The number of validation block has to match the number of consecutive days you want to restrict. If validation for 7 consecutive days is required, then 7 validation blocks must be configured, checking all possible consecutive 7 days involving the current day.

  1. First Block
    • Select the attendance type you want to validate.
    • Use Lookup() together with Date Plus() to check whether the same attendance type exists for yesterday(-1 day) and the day before yesterday(-2 days), relative to the current date.
    • An error will be raised if the same attendance type exists on both yesterday and the day before yesterday, in addition to the current date.
  2. Second Block
    • Adjust the “Number of Days” field to validate whether the same attendance type exists for yesterday (-1 day) and tomorrow (+1 day), relative to the current date.
    • An error will be raised if the same attendance type exists on both yesterday and tomorrow, in addition to the current date.
  3. Third Block
    • Adjust the “Number of Days” field to validate whether the same attendance type exists for tomorrow (+1 day) and the day after tomorrow (+2 days), relative to the current date.
    • An error will be raised if the same attendance type exists on both tomorrow and the day after tomorrow, in addition to the current date.
  4. Assign the rule to the Employee Time Sheet Entry object definition as Save Rule.
  5. If the attendance type BLUE_22DAYS is recorded on 3 consecutive days, an error will be raised in the Time Sheet UI.

Note:

  • Business rules can only trigger errors. Warnings and informative messages are not supported.
  • For flexible approval period time sheets, similar logic business rule should be created based on Time Recording object and assigned as Save Rule in object definition of Time Recording.
  • To raise a warning message, please refer to KBA 2561209 and configure time valuation to validate consecutive working days. However time valuation only works within the same time sheet period, meaning the system cannot detect consecutive days if they span across two different time sheet periods.

See Also

Keywords

Successfactors, Time Sheet, Time Tracking, business rule, consecutive days, attendance, overtime, restriction, weekly, employee time sheet entry, MDF, validation, error, alert , KBA , LOD-SF-EC-TMS , Time Sheet , LOD-SF-TTR , Time Tracking , How To

Product

SAP SuccessFactors Employee Central all versions ; SAP SuccessFactors HCM Suite all versions ; SAP SuccessFactors Time Tracking all versions

Attachments

SCREEJ1.png
1.png