Human Capital Management Blogs by SAP
Get insider info on HCM solutions for core HR and payroll, time and attendance, talent management, employee experience management, and more in this SAP blog.
cancel
Showing results for 
Search instead for 
Did you mean: 
Volker_Ruof
Product and Topic Expert
Product and Topic Expert
Hello,

it has been a while... but here we go again with some cool thing I want to share with you.

You know the business rules concept in EC. Business rules are a very important and powerful tool set and is heavily used especially in Time Off. You can use them to:

  • to calculate regular leave accruals

  • do proration of accruals when an employee is hired/terminated during the year or needs to be recalculated based on unpaid leaves

  • do input validation checks when an absence is recorded based on the duration of the absence, working days, calendar days

  • do cross validations with the duration of other absences in the year

  • and many more


As mentioned, business rules are powerful - but this comes a bit at the cost of complexity. Depending on your requirements business rules can be very complex and not easy to build. When you have lots of if-else clauses where you need calculated values you are for example in the need of repeating this calculation in each if-else clause. And this makes the rule not only slow - cause each time something needs to be calculated - but also complicated to create and complicated to understand for people who where not involved from the beginning in creating the rule. And it happens quite often that you must adapt or analyze a rule that someone else has created.

So, what would you say if we provide something that makes your life easier it this respect?

What would you say when our rules framework team would have developed something that allows to calculate a value, store it and have it available in each if/else clause without the need of calculating it anew?

I would say: big thank you to the rules framework team for this excellent feature.

Lets look how it works:

In the business rule configuration you can calculate a value right at the top of the rule using the normal business rule functions and -this is now the new thing -  you can store this value in a variable. This variable can then be used in each if/else clause.

Benefit is twofold:

a) it increases the performance of your business rule to a large extend cause you don´t have to calculate in each if-clause the value you need, you are just referring to the once calcualted and now stored value in your variable and this fastens the processing of your rule

b) the complexity of the rules in general can be simplified. This eases the creation and the understanding of the rule for others

So, how does this look like in real practice? Lets take an example where a interim time account update rule needs to check the actual balance of a time account.

When the balance is less than 5 days nothing is done. The balance stays as it is.

When the balance is between 5 and 10 then the balance shall be reduced by 50% of the delta from 5 - 10. So when there is a balance of 9 the delta to 5 is 4. And this is reduced by 50% so that in the end the balance is reduced to 7.

And when the balance is bigger than 10  all days shall be lost.

The purpose of the rule is to have employees encouraged to take their leaves at a given point in time, otherwise they might loose days. The higher the remaining balance, the more they loose.

You can see in this rule that first a variable is calculated "var_balance" using the "calculate balance" rule function. This function calculates the actual balance of the employee and with the new feature stores this value in the variable var_balance.

And this is only an example of an easy value calculation. There are often much more complex calculations. And instead of doing this calculations in each If / elseif section you just query this variable before your "then" part.



 

This is it. Quite simple, but very efficient in terms of performance and your rule gets more clearly arranged and understandable.

 

Hope this helps.

Regards

Volker
12 Comments