ABAP Keyword Documentation →  ABAP − Reference →  Processing Internal Data →  Numeric Calculations →  Numerical Functions → 

nmax, nmin - Numerical Extremum Functions

Syntax Forms

... nmax|nmin( val1 = arg1 val2 = arg2 [val3 = arg3] ... [val9 = arg9] ) ...

Effect

These functions return the value of the biggest or the smallest of the arguments passed. At least two arguments, arg1 and arg2, and a maximum of nine arguments must be passed, whereby the optional input parameters val3 to val9 must be filled in ascending order without gaps. The arguments arg1 to arg9 are numerical expression positions.

The following applies for the data type of the return value:

Notes

result =  nmax|nmin( val1 = arg1 val2 = arg2 )

the evaluation of the functions is equivalent to:

IF num1 >= num2 | num1 <= num2.
  result = num1.
ELSE.
  result = num2.
ENDIF.

When using more than two input parameters, an equivalent control structure would be more complex.

Example

For a demonstration of the extremum functions nmax and nmin, refer to the extremum functions nmax, nmin.