Human Capital Management Blogs by SAP
Get insider info on SAP SuccessFactors HCM suite 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: 
NeeleshKamath
Product and Topic Expert
Product and Topic Expert

Hello Everyone

This is regarding calculating accruals based on dependent age. I have seen many such questions floating around the customer and partner community. Hence wanted to share a possible solution for now.

Let’s look at a sample requirement “A customer's requirement is, that Vacation days are added for each child under 12 years of age”. For example, if there are 3 children and only 2 are below 12 years, the accrual should be 20 (2 * 10 days per child). “

 

We have two ways of handling this. You can follow the approach you like

Option 1: Using Custom field and Integration Center


Coming to this solution, you can follow the below steps and check the results yourself. Further, you can adapt

 

Procedure


 

1. Create a custom field in Dependents “IsEligibleForAccrual” using BCUI.


 

2. Create a new on Save rule on the same dependent portlet to set this custom field based on your requirement of 12 years (144 months)

 


3. In the accrual rule use the cardinality rule function to check the number of dependents matching this field as “YES”


 

Testing


 

The current employee has two eligible dependent Childs


 

In my sample rule, I am providing 10 days per dependent matching the criteria

 

The accrual granted is 20 days which is correct in this case


 

Integration Center to update dependents in subsequent years


 

The eligibility of existing dependents which were added after the employee is hired can change in subsequent years. For example, If there is a child born in 2008 would become 13 years in 2021. As a result, at beginning of 2021, we need to update this eligibility field to “NO” so that the accruals for 2021 can consider this

To achieve this consider the below design

Create a outbound integration to output the current dependents in system into a csv file in SFTP folder


Example:


Add a calculated field named “Years” and add the following calculation


This gives the difference between the date of birth of dependent and today (Jan 1st of every year)

Sample file extracted



Create an inbound integration to read the csv file (exported in above step) from SFTP folder

 


Map the fields Person ID External , Related Person ID External

Make Start date as calculated field which is resolved to today or NOW

Also make the isEligibleForAccrual as calculated field with below calculation by using "Choose" Operator


It is a switch case where if the Years field from CSV is between 1 to 12 , it will be set to YES

Otherwise NO

 

Small Test

After I run the integration centre report, the dependent who is now 13 years in 2021 is updated

 


You can schedule these integrations every year (Beginning of Jan) if your accrual calendar year is Jan - Dec. This would ensure that the dependent's eligibility is set as per their age at that moment.

Post this, you can run the accrual calendars for this time account type

Other considerations

    • Instead of years if you want months, you need to add numbers from 1 to 144 in your switch case, as in IC the if else condition does not provide filters less than currently

 

    • You can add additional time based filters to prevent reading all dependents. This can depend on your use case



Option 2:


You can use the below rule and rule function to check if a child is less than 15 years or 180 months as of accrual date


What this rule does? It basically sorts the employee's dependents with relationship child (external code =2) as per their DOB. And it checks the position/rank of the first child meeting the criteria of less than <= 180 months. . For example say there are 5 children and the first child meeting the criteria of<=180 months is at rank 3, this means the first 2 children are above>= 180 months and all children below 3rd position i.e child 4 and 5 are <=180 months. So in total, we have 5-2 = 3 children meeting these criteria.  Hence you can then use this number 3 to further calculate the accruals

You can also embed this logic in accrual rule directly instead of using it via custom MDF. Below is the snippets of rule to do the same. Extend the pattern for any number of children you need. The below logic also takes into consideration any new children born during the year.  Hence we check the dependent count at beginning of accrual period and also end of accrual period.

Also in below example, we provide 1 day per child who is less than 180 months or 15 years

NeeleshKamath_0-1713448577115.png

NeeleshKamath_1-1713448689510.png

NeeleshKamath_2-1713448787701.png

NeeleshKamath_4-1713448908894.png

NeeleshKamath_5-1713448935754.png

We have implemented this for Best practices Time Off Croatia. If you are interested to look at complete rule, you can also run best practices for time off Croatia (HRV) in your successfactors instance


This is a simpler way instead of option 1. Further, the rule is limited to only 3 children in the picture but you can extend it to any number of children. Just continue the pattern and logic

Option 3:

Recently one of our colleagues @SoraiaLatif came up with another innovative and creative way of handling this requirement. You can have a look at her blog too 

SuccessFactors Time Off Accruals: Calculation base... - SAP Community

You could go through all three options and adopt the one that suits your needs

 

Disclaimer:

The current solution does not cover accrual recalculation for ex: when a new eligible child is added. But such challenges can be overcome by scheduling periodically the time off calendars.

If I get a way to automate this step as well, Will enhance this blog or create a new one.

Also please evaluate this with your customer, before adopting the solution.

 

Thanks

Neelesh

28 Comments
parthu6
Participant
0 Kudos
Nice blog neelesh.kamath and I have a small query on Treat Null As() function you used TREAT NULL AS() function because to avoid inconsistency if there are no YES records in the system, correct me if I’m wrong.

 

Considering your example there are 2 YES records, so first system checks whether there are none of YES records maintained and if none YES records exist then rule will update the VALUE with 0; when multiply any number with 0 will be 0 so no output and if YES records are maintained then the VALUE will be 2( based on example)  and Factor is 10 so output will be 2*10=20.

 

My Query is what happens if we directly use Cardinality function in VALUE field, will system throw error or Accruals will generate with different value?

 

Thanks,

Parthu.
NeeleshKamath
Product and Topic Expert
Product and Topic Expert
0 Kudos
HI Parthu

Thanks for the feedback. I generally use Treat Null As with all these functions as some return NULL and some a numeric value. Hence Do not want the rule to fail because of an unhandled null case.. But I guess for Cardinality you can make use of the function directly on the value as it is numeric.

Please give it a try

Thanks

Neelesh
0 Kudos
Hi Neelesh,

thanks for the information you shared, I am just facing this situation. About that, I have a couple of questions about the process you follow.

If the rule is an onSave trigger scenario, then this information is going to be useful just one time. I mean:

  1. I upload dependents information, or get it updated by employees, so eligibility field is going to be updated thanks to the onSave rule scenario.

  2. I run accruals for this year and everything is ok.

  3. What happens next year? As this eligibility is not going to be updated, unless you update the dependent information and the eligibility gets updated through the onSave scenario. Am I right? Or maybe I did not understand something in the process?


Additionally, I do not get the point of calculating eligibility based on dependent's date of birth and event date, I would calculate eligibility based on date of birth and today, to determine age and this would let me calculate eligibility.

Thanks for your time and effort to share knowledge.

Best regards,

Isra
NeeleshKamath
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Isra

Regarding your comments

  1. I upload dependents information, or get it updated by employees, so eligibility field is going to be updated thanks to the onSave rule scenario. – Correct. 
  2. I run accruals for this year and everything is ok. – Correct
  3. What happens next year? As this eligibility is not going to be updated, unless you update the dependent information and the eligibility gets updated through the onSave scenario. Am I right? Or maybe I did not understand something in the process? – I updated the blog, Check Integration center approach. The integration center has to be run before the accrual calendar

Additionally, I do not get the point of calculating eligibility based on dependent’s date of birth and event date, I would calculate eligibility based on date of birth and today, to determine age and this would let me calculate eligibility. – yes you are right. I just created a POC and tested with event date = today. Practically Today makes sense. 

Thanks & BR

Neelesh

fgarayevaz
Participant
0 Kudos

Hi Neelesh,

On the second option did you use new custom object Sub Quota for Vacation per Employee SVN?

Regards,

Fuad

NeeleshKamath
Product and Topic Expert
Product and Topic Expert
Hi Fuad,

Yes I used a custom MDF in my implementation for different reasons but you can use this rule function directly in accrual rule as well and use else if to create different accrual values based on conditions

Regards

Neelesh
fgarayevaz
Participant
0 Kudos
Dear Neelesh,

Coming back to this question one more time. Option 2 for me still it is unclear to which object/portlet you have assigned the mentioned Rule ? Is it assigned on Dependent portlet onSave ?

Could you pls elaborate a little bit more your option 2 ?

Regards,

Fuad
NeeleshKamath
Product and Topic Expert
Product and Topic Expert
Hi Fuad,

In My case, I am storing the dependent eligibility in a custom MDF as my requirement was something else where I had to calculate the quota based on different parameters for an employee

However, you can use this directly in the accrual rule itself as this is a rule function-based logic. You can use these rule functions in different if-else conditions of the accrual rule and then set the accrual value of time account details

I have also used this logic directly in accrual rules for some other requirement

Regards

Neelesh
rsriramm
Participant
0 Kudos
Hi Neelesh,

 

This is a great blog and was looking exactly looking for this solution for one of our requirement.

Below is code snippet which we have configured following your option 2 but not working as expected.

Employee has one dependent effective 4 Jul 2022 with DOB as 4 Jul 2022



 

Dependent information:


 

when we run simulator for the employee, expected result was 5 days but we are getting 0 days and below is the rule log


Not sure how the system calculates 41.21 when the DOB of dependent is 04 Jul 2022.

Can you please help us here.

 

Thanks,

Sriram
NeeleshKamath
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Sriram

Couple of issues I anticipate here

  1. The dependent at Rank 1 has an age of 41 months. Are you sure there is only one child with relationship type 13?  This is because you can have multiple children and you need to use different if-else conditions to check at which rank you get a child which is less than 36 months. So you need to check this for all ranks : Rank 1, 2,3,4 ..In your rule I see only rank1 . This will work only if you have one child which is less than 36 months. But in screenshot it looks like you have added son3 (child 3). Please check the dependent history again to see how many children are there until July 4th 2022. If you have children in past then your rule logic will not work with just Rank 1. I hope you got my point..
  2. Also do not make use of context.effectivedate if you are using it in accrual rule. In my case it was MDF. You can make use of accruable end or start date for "As on Date " Parameter of these rule functions

Try with accruable end date and also different rank conditions to see from which rank you get the child which is less than 36 months

This logic has been implemented by a couple of partners and it is working for them successfully.

 

rsriramm
Participant
0 Kudos
Hi neelesh.kamath,

 

Thank you so much for taking time in replying to my query. Changed As on Date from Context.Effective Date to Accrual Rule Parameters.Accruable Start Date and it is now working as expected. Have couple of questions:

  1. Can we handle both relationship type 2 and 13 and based on the combined count entitlement to be accrued. For example if an employee has 1 son and 2 daughter whose age is less than 3 yrs, entitlement should be 5*3 = 15 and if another employee has 1 son and 1 daughter then entitlement should be 5*2 = 10.

  2. Can we do this check on daily basis and accrue the entitlement if the condition satisfies.


 

Thanks,

Sriram
NeeleshKamath
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hi Sriram,

To answer your questions

  1. Can we handle both relationship type 2 and 13 and based on the combined count entitlement to be accrued. For example if an employee has 1 son and 2 daughter whose age is less than 3 yrs, entitlement should be 5*3 = 15 and if another employee has 1 son and 1 daughter then entitlement should be 5*2 = 10.  - Yes I guess this can be handled. You need to use similar logic as I have described in my screenshot for each rank. Say you want to check max for 3 son and 3 daughter you would need 9 else if conditions.. Like Rank1 of Son and Rank 1 of Girl, Rank 1 of Sona and Rank 2 of Girl, Rank1 of Son and Rank 3 of Girl, Rank 2 of son and Rank 1 of Girl....To cover all combinations

  2. Can we do this check on a daily basis and accrue the entitlement if the condition is satisfied. - Not possible directly...However, you can schedule jobs to say every week/daily with recalculation on in Time off Calendars. So if a new child is born , the accrual rule will run again and recalculate original accrual and change it

fgarayevaz
Participant
0 Kudos
Hi Neelesh,

Lemme explain what we are trying to do:

Requirement:

If employee has 2 or less dependent under 12 years then 1 day, else if more than 2 the 2 days on monthly based is granted on monthly based. We have a custom field in dependent portlet which stores is Yes and No and everything is updated regarding to your Option 1.

Solution:

From Time Management point of view balance is granted separately on monthly based and that's why we have to use Ad-hoc type. If we use Ad-hoc type time account type then object Time account and time account details has to be created manually:

Time account:

Via the Integration center we are able to export csv with required columns and then import back and it successfully creates ad-hoc time account to all active employees with 0 balance.

Time Account Details:

Here we plan the same approach but main source of data should be custom object where we store the eligibility result and balance number (1 or 2). Via the business rule create record in custom object after that via this custom object and Integration center update Time account details for everyone who should be granted 1 or 2 days.

 

Question

Problem here from dependent portlet we have some troubles to create record in our custom object via rule. But from your screens for Option 2 you managed to set a value to the field of your custom object. I'm just curious to see you rule scenario, parameters and the place where you put your rule in manage business configuration.

And additionally maybe you can also share your knowledge and experience in this overall approach.

Regards,

Fuad
NeeleshKamath
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Fuad

I have attached the config of custom MDF and rule below

 

The custom MDF is created using IC where starting entity is user and the target is the custom MDF

It is similar to the blog I wrote in below. The IC is run periodically based on a schedule and the custom MDF is updated using on Save rules

https://blogs.sap.com/2021/10/22/timely-time-sheet-alerts-for-no-records-on-previous-working-day/

marrup
Explorer
0 Kudos

Hi neelesh.kamath ,

 

Can you explain me how I can schedule the job to run every day or week?

 

I have setup an annual time account type for "Sick Child", it's using the dependents portal to accrue the number of days you will get. If you have 1 child under 12 you will get 10 days. Everything is working on hire, or when we create the accruals for the "next" year. The Time Account Type is Annual.

But after reading your blog post, and this sentence " But such challenges can be overcome by scheduling periodically the time off calendars." I started to wonder what is wrong with my setup?

Maybe my issue is that the Time Account Type has frequency "Annual"? and therefore not possible to schedule it more often in the Manage Time Off Calendar?

During a year a new child can be added in the Dependents portlet and thus I would like the quota balance to automatically be updated. It does not need to be immediately, but the day or week after is fine.

I hope you can help me and direct me in the correct way.

Thanks for a good post!

NeeleshKamath
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi @marrup ,

You can periodically schedule your calendars from manage time off calendars...I am assuming you have the accrual logic to find number of children below a certain age in the accrual rule itself (like option 2 in my case)..If a new child is born mid of a year, ideally the acrrual calendar should be invoked again and your accual rule should be written in such a way that it recalculates the actual value

When to recalculate

  1. You count the number of children as of the beginning of the year (Say Jan) - accrual start date
  2. Again count the number of children in the rule as of High Date i.e end of the year (Day Dec) - accrual end date

If 2 > 1, it is clear that there is a new child added in the middle of year (because in such a case the child is valid also as of end of the year but its not valid at beginning of the year)..Then in such a case give an additional accrual on top of whatever you have calculated with existing logic.

 

if 2 == 1 , the accrual rule will give the same value, hence no change is required

In order to run recalculation, you would need to schedule the accrual calendars with recal flag ON every week in advance

marrup
Explorer
0 Kudos
Hi,

 

This is what I see in Manage Time Off Calendars:


I don't see any possibility to make it run every week?
NeeleshKamath
Product and Topic Expert
Product and Topic Expert
you will have to create multiple calendar run for each week and schedule them..Please look at time management implementation guide for further details on time calendar
marrup
Explorer
0 Kudos

Thanks, I got it. I hoped there was a schedule feature or something I have missed.

will see if i can find a smart way. I was thinking about using IC to create new time account calendars every week.

mcardoso23
Discoverer
0 Kudos

Hi Neelash,

Thank you for your detailed explanation.

I have followed the steps that you described for option 1 however, I am getting an error in the inbound integration. Please see below:

Do you know what could be the root cause of this?

Thank you,

Maria

abhineetarora11
Explorer
0 Kudos
Hi Neelesh,

accrual needed from the date of birth of the child, is that possible and if yes, how?
NeeleshKamath
Product and Topic Expert
Product and Topic Expert
0 Kudos
It Is not possible directly from date of birth. You can only use "Get youngest Dependent" and get age of dependnets based on rank
abhineetarora11
Explorer
0 Kudos
but then how would you use Ad Hoc Time Accounts to meet this requirement where the start date of the time account should begin with the date of birth of the child  till the time the child is 8 years. Could you please help?

Regards

Abhineet
NeeleshKamath
Product and Topic Expert
Product and Topic Expert
0 Kudos
This blog is not about creating accounts for each child. In this blog, I demonstrate how we can use rank and number of children less than an age limit every year to decide on accruals every year. For your requirement, please take a look at my another blog

https://blogs.sap.com/2022/07/13/child-care-leave-china-workaround-in-successfactors/

Perhaps this blog is closest to your requirment
Davidburke_IRE
Explorer
0 Kudos
Hi Neelash,

Is the custom field in the depedents portlet pointing to a picklist, boolean or a generic object?

Just get errors writing back data into the field via inbound integration.

Thanks

David
NeeleshKamath
Product and Topic Expert
Product and Topic Expert
0 Kudos
Hi David

It is a plain string with value "YES" and "NO"

 
Bernardo_Santos
Participant
0 Kudos
I'm trying to implement it, but it's showing the picklist code in the "BNA Extraction Age Children" field instead of "Yes", "No". Any idea?


Thanks
NeeleshKamath
Product and Topic Expert
Product and Topic Expert
0 Kudos
I am not sure about this field. In my blog "Is Eligible for Accrual is a custom field" and we store strings "YES" and "NO". If you are creating a custom field, dont use a picklist