Symptom
How to get the last day of a month using business rule.
Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental
Environment
SAP SuccessFactors Employee Central
Reproducing the Issue
Using a business rule, you want to retrieve below dates in Job Information portlet:
- The end date of current month.
- The first date of next month.
- The end date of next month.
Resolution
- Create a custom date field and provide all the permissions to view on the UI.
- Create a business rule (in this example creating the dates in the variable so that the can be reused within the rule configuration). For this particular example we're creating an always true rule.
- Assign the rule as OnSave in Business Configuration UI (BCUI) > jobInfo. On save of Job Information record, the fields are filled as below:
- If today's date is 18 of February 2024:
-
- The fist day of the month is 01/02/2024
- the last day of the month is 29/02/2024 (the system has correctly derived the leap year)
- the first day of the NEXT month is 01/03/2024
-
- This rule will always return the correct end date of the month including for Leap Year (29 February as can be noted in the screenshot).
Keywords
Last day of month, Last day, Last day in business rule, Find last day of month, first day, leap year, business rule , KBA , LOD-SF-EC-JOB-RUL , Job Info Business Rules , LOD-SF-EC-JOB , Job Information , How To
Product
SAP SuccessFactors Employee Central 2605
Attachments
| Pasted image.png |
| Pasted image.png |
SAP Knowledge Base Article - Public