SAP CMAX CMIN FUNCTIONS

Get Example source ABAP code based on a different SAP table
  


ARTICLE
• cmax ABAP_FUNCTION
• cmin ABAP_FUNCTION

cmax, cmin - Character-Like Extreme Value Functions

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

Effect
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.

Latest notes: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.

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