Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Processing Internal Data →  Character String and Byte String Processing →  Expressions and Functions for String Processing →  String Functions →  Processing Functions for Character-Like Arguments 

cmax, cmin - Character-Like Extreme Value Functions

Other versions: 7.31 | 7.40 | 7.54

Syntax Forms

... cmax|cmin( val1 = text1  val2 = text2
              [val3 = text3] ... [val9 = text9] ) ...


These functions return the value of the biggest or the smallest of the character-like arguments text1, text2, ... passed. The content of the arguments is compared from left to right in the evaluation. The first different character from the left decides which operand is bigger or smaller on the basis of the sequence in the code page used.

At least two arguments, text1 and text2, and a maximum of nine arguments must be passed, whereby the optional input parameters val3 through val9 must be filled in ascending order without gaps.

The return code has the type string.


  • The extreme functions nmax and nmin can be used to determine numeric extreme values.
  • Character-like extreme functions, like numeric extreme functions, can be traced back to the equivalent control structures using relational operators. Remember that, unlike with the usual ABAP comparison rules, shorter arguments of fixed lengths are not padded to the length of longer arguments by entering blank spaces.
  • As with comparisons with relational operators, the current locale is not significant when determining the extreme values.


For a demonstration of the extreme functions cmax and cmin, refer to the character string functions cmax, cmin, and segment.