Symptom
- You wish to calculate the age of an employee and maintain this information in the biographical information Portlet
- How to Create a Business Rule to Calculate Age
"Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental."
Environment
Employee Central - Biographical Information
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" max-length="25" visibility="view">
<label xml:lang="en-US">Age Custom Double</label>
<label>Age Custom Double</label>
<label xml:lang="fr-FR">SAPAge calculation</label>
</hris-field>
<hris-field id="custom-string1" max-length="256" visibility="none">
<label xml:lang="en-US">Age Custom String</label>
<label>Age Custom String</label>
</hris-field>
Via :Go to Manage business configuration ( BCUI)
Step 2: 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
Edit mode
Rule UI
Step 3:Add onView Rule under Biographical Information element - either via SDM Data model or Manage business configuration ( BCUI)
Step 4: test configuratio
Go to Any user Biographical Information
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
- 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?
Keywords
Business Rules, Calculating Age, Calculate Age, Age Field, age, custom-double1 , KBA , LOD-SF-EC-PER-BIO , Biographical Info - Config, Rules, RBP, UI , LOD-SF-EC , Employee Central , How To