Human Capital Management Blog Posts by Members
Explore blogs from customers or SAP partners to gain best practices and fresh insights to succeed.
cancel
Showing results for 
Search instead for 
Did you mean: 
NicklasH37
Discoverer
1,322

The Time Valuation in SuccessFactors Time Management is still a few updates away from the full functionality of Time Management in SAP HCM “On-Premise”. All the recent praise of the module is very much deserved though, as the rapid rate of development showcases the ambitions of the module.

Currently, there are still a few cases of gaps within the standard solution though – such as the week in the period of the new Time Statement functionality always starting on a Sunday. It would perhaps be a good idea for SAP to enrich the Time Statement Configuration object to define the start day of the week.

The purpose of this article is not to discuss the Time Statement, but to showcase a solution for one of the gaps that currently exist in the system, within “normal” configuration options. The scenario is a customer with Time Tracking and integration into Employee Central Payroll.

The Customer Requirement

Recently, a customer requirement I faced was that they required a Time Off in Lieu Time Account to be updated based on as little as a commenced half hour.

For example, an employee working within the timeframe of 00:00 to 06:00 is for each hour worked within that timeframe, to be granted 25 minutes to the TOIL account. Further complicating matters is, that if the employee worked for half an hour or less within said timeframe – yes, down to even just a minute – the minutes to be granted to the TOIL account should be half of the “normal”, e.g. in this case, 12,5 minutes. In the case that 31 to 60 minutes was worked, the full 25 minutes should be attributed to the TOIL account. As they called it, each commenced half an hour needs to be evaluated.

The proposed solutions

Initially, neither I nor my colleagues could identify a simple solution to the above requirement. In the Time Valuation, we had created a simple valuation to create a 1:1 attribution to the TOIL account of the time worked within the timeframe. From this, we discussed using the Integration Center to move different values around, but found this to be a highly unstable approach.

We further considered if we could establish some logic within CPI to get a more stable solution, and was in the process of investigating this. Ultimately, we did not go far down this specific avenue, as I thought we should be able to do this just within the SuccessFactors system. Then Business Rules in Time Valuation was announced for general release, and we hoped that would be the best solution. From what we could gather from beta testers, that was not the case for our specific requirement, though.

With that news, I decided to revisit a previously discarded idea, and to “just” have a Business Rule be the solution.

The actual solution

I decided to start with looking at the Time Valuation and the setup for the 1:1 attribution to the TOIL account, and noted the External Name and External Code from the setup of the final result TTG:

Example of Time Type Group for TOIL accountExample of Time Type Group for TOIL account

From here, I decided to inspect the Employee Time Sheet object, to see what was going on there, and found this:

Time Sheet with Time Sheet Entry and Time Valuation ResultTime Sheet with Time Sheet Entry and Time Valuation Result

As we can see, a Time Sheet Entry of 2 hours of performed work within the timeframe, would result in a Time Valuation Result, which is worth inspecting in detail:

Time Valuation Result Detail ViewTime Valuation Result Detail View

In summary, what we see is that the Time Valuation Result natively has a Posting Target of Time Account, a Pay Type Name being the same as the External Name from the TTG, and a Pay Type Code equal to the External Code of the TTG.

This led me to believe that with this information, I had everything I needed for a Business Rule. Except one thing – a way to not hardcode the final result in the Business Rule. For this, I created a Custom MDF to be used as a lookup table. Ultimately, I landed on a design like this:

Custom MDF object used as a lookup tableCustom MDF object used as a lookup table

This design was partly because of the requirement from the customer, that if even 1 minute is worked, then it is to count as a full half hour – a commenced half hour as they called it – which was to attributed a certain amount of minutes to an employee.

This led me to believe that I needed to make use of the Round() function in the Business Rule, hence the above design, as each half hour within the timeframe of 00:00 to 06:00 was to be defined with a final result to be looked up, based on what the result of the Round() function was.

With the above in mind, I created the following Business Rule:

A Business Rule for Rounding of Employee Time Valuation ResultA Business Rule for Rounding of Employee Time Valuation Result

I found that the Round() function did not natively support a rounding of a half at a time, so some mathemagics were needed to do this. Basically, we take the Hours of the Employee Time Valuation Result and multiply by 2, and then round this number, and then divide by 2. The specific calculation in the above rule is because we want to round up. If we wanted to down Precision in the above rule would be 0, and threshold still 0 (we want 0 decimals).

Once all of the mathemagics are done, we use the result of this, in the Lookup() function to select the actual final result – what we want posted to the TOIL account.

For transparency reasons, in the Lookup table I have called the first interesting column “Result Pre Rule” – which is actually post Rounding – and what will be transferred to the actual Time Valuation Result as “Result Post Rule”.

I assigned the rule to the Object Definition of Employee Time Valuation Result, as a Save Rule.

The final result

Time Sheet with Time Sheet Entry and Time Valuation Result Post RuleTime Sheet with Time Sheet Entry and Time Valuation Result Post Rule

With the exact same Time Sheet Entry as previously, we can now see that the actual hours posted is in corresponding to what we configured in the custom MDF object – 50 minutes, or 0.83 hours. If we were to perform a Rule Trace, we can actually see what is happening:

Rule Trace on Previous Rule after saving of recorded time in Time Sheet UIRule Trace on Previous Rule after saving of recorded time in Time Sheet UI

We can naturally follow the If conditions being compared and found true, and the initial result before anything in the rule is happening to be “2”, and this then being multiplied, rounded, and divided. Finally we see the lookup , and the setting of the hours to be “0.83”. As such, we are able to fulfill the requirement to valuate each commenced half hour and attributed to the TOIL account, what is needed.

Things to note

All of the above is all well and good, but there are some points that need to be highlighted as they detract from the above solution. For example, you may have noticed that the first entry in the custom MDF states we want to add 0.21 hours, or 12.5 minutes, to the TOIL account.

This we cannot actually do, as we cannot add minutes and seconds to a TOIL account, only minutes and hours. In essence, this means that in the circumstances where we would want to add XX minutes and 30 seconds, it will always be XX+1 minutes instead. Luckily, our customer was more than happy with this limitation, since they were facing a lot of manual corrections to the TOIL account for a 4 digit number of employees. 30 seconds here and there was not bad.

Further, it is also worth noting that whilst initially the save rule actually goes through in the Time Sheet UI in the Time Sheet Accounts section, under “Added by the current time sheet” like so:

Time Sheet UI right after saving recorded timeTime Sheet UI right after saving recorded time

It actually reverts to be equal to the time sheet entry upon reload of the time sheet UI:

Time Sheet UI after reload of same Time Sheet as previouslyTime Sheet UI after reload of same Time Sheet as previously

Thankfully, this is only “cosmetic” as the result of the Business Rules are still final, as we can see in the Total for the Timebank TOIL account. It is still annoying though.

These final notes on my solution to implement Time Valuation on Commenced Half Hour concludes this article. I hope this solution can help the community with meeting similar requirements in the future, whilst we await all the good things still to come for SuccessFactors Time Management.

2 Comments