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.

These functions return the minimum/maximum values out of the input argument.

Syntax:
result = nmax|nmin( val1 = arg1 val2 = arg2....val5 = arg5 ..val9 = arg9 ).

Features:
- All the input arguments are of type numeric data object/ numeric expressions.
- 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,
As always, I hope this information helps you with your day-to-day work.

Popular posts from this blog

ABAP convert internal table to excel (.xlsx) format and Send email or download

ABAP read excel(.XLSX) file to internal table in ABAP using CL_FDT_XL_SPREADSHEET

Application Logging in ABAP