Abap Predefined function nmax and nmin
As part of the ABAP predefined functions series, today I wanted to talk about
numerical Extremum functions: NMIN, and NMAX.
Syntax:
result = nmax|nmin( val1 = arg1 val2 = arg2....val5 = arg5 ..val9 = arg9 ).
Features:
These functions return the minimum/maximum values out of the
input argument.
result = nmax|nmin( val1 = arg1 val2 = arg2....val5 = arg5 ..val9 = arg9 ).
Features:
- All the input arguments are of type numeric data object/ numeric
expressions.
As always, I hope this information helps you with your day-to-day work.
- A minimum of two arguments must be passed up to 9.
Example:
It's elementary to start undermining the function as an extreme of two can be easily calculated with a simple if-else:
but what if 3, or 4 or more fields were involved:
You can notice how the ifs are increasing but it's a simple method call to NMAX or NMIN to achieve the same.
Below is a small ready-to-execute report to calculate the least or highest
value of input values of up to 9 variables,