I want to frequently post little tips for SAP PI and SAP PO. Perhaps for the more experienced what will post is not new, but the intention is to help who is entering now in this world.
In this first post I will show you how to do calculate age, having as input parameters the date of birth and the current date, the result must be the age in years.
Since there is no standard function, you must perform this calculation in a few steps, the first is to validate if the birthday date has already passed, so we use the DateBefore function. If the anniversary date has already passed, simply subtract the year of birth of the current year, and if the anniversary date has not yet passed you must subtract the year of birth and subtract 1.
Below is an example, a person born on April 3, 1985 is 33 years old on March 15, 2019 (date of calculation).
I hope you have enjoyed the tip, and I will post more tips soon.