SAP Knowledge Base Article - Public

3438482 - How to Create a Business Rule to Calculate User hire date Age Based on Current Hire Date

Symptom

How to Create a Business Rule to Calculate User hire date Age Based on Current Hire Date.

"Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental."

Resolution

There are two different ways in which the age of your employees can be displayed.

They are YY/MM/DD or the value in years (Rounded Down).

  • In order to use the YY/MM/DD format you must ensure the age field is a custom string field.
  • In order to use the value in years (rounded down) you must ensure the age field is a custom double (Numeric) field.

Step 1: Create  both custom Field

Via Code SDM Data Model 

    <hris-field id="custom-double1" visibility="both">
      <label xml:lang="en-US">User hire date Age calculation</label>
      <label xml:lang="fr-FR">User hire date Age calculation</label>
      <label xml:lang="en-GB">User hire date Age calculation</label>
      <label>User hire date Age calculation</label>
    </hris-field>
    <hris-field id="custom-double2" visibility="both">
      <label xml:lang="en-US">Totalhire date Age calculation</label>
      <label xml:lang="en-GB">Totalhire date Age calculation</label>
    </hris-field>
    <hris-field id="custom-double3" visibility="both">
      <label xml:lang="en-US">AddUser hire date Age calculation</label>
    </hris-field>
    <hris-field id="custom-string19" max-length="256" visibility="both">
      <label xml:lang="en-DEBUG">String_hire date Age calculation</label>
      <label xml:lang="en-US">User String_hire date Age calculation</label>
      <label xml:lang="en-GB">String_hire date Age calculation</label>
      <label>String_hire date Age calculation</label>
    </hris-field>

Via :Go to Manage business configuration ( BCUI)

Step 2: grant a permission under: employee data

Step 3: Create rule:

Go to Admin Centre> Configure Business Rules

Create a Basic Rule with Base object Biographical information.

  • For YY/MM/DD create a rule using the "Convert to YY/MM/DD" function for custom-string
  • For the age value (rounded down) use the "Difference in Years Round Down" function for custom-Double

see

check result

Additional infos:

Add 2  custom double field and default to into custom field

Create a rule: 

chek result:

NOTE: onView, Calculated fields are transient fields and so no data is saved to the system. The Values will dynamically calculate each time that you visit the users Biographical Information. You will not be able to report on the value, so long as the rule is set to trigger onView.

See Also

  • 2345108 - How to Create a Business Rule to Calculate User Age
  • 2364155 - Age field not displaying values in Advanced Reporting
  • 2577292 - How to calculate age on a specific event date in Online Report Designer?
  • 2571171 - How to create a Age calculation field in Integration Center
  • 2515212 - How to get "number of years" an employee is working in the organization in ORD or Advance Reporting?
  • 2431354 - How to calculate the service anniversary (seniority) of an Employee who had break in service 
  • 2768749 - Termination Date excluded in calculation for Number of Months in Termination Rule

Keywords

KBA , LOD-SF-EC-EMP , Employment Information (Employment Details) , How To

Product

SAP SuccessFactors HXM Core 2311