SAP CMAX CMIN FUNCTIONS



Get Example source ABAP code based on a different SAP table
  


• cmax ABAP_FUNCTION
• cmin ABAP_FUNCTION
• val cmax function
• val cmin function

ABAP_STRINGFUNC - cmax, cmin

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

What does it do?
These built-in 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 determines which operand is bigger or smaller based on the order in the code page used.
At least two arguments, text1 and text2, and a maximum of nine arguments must be passed. Here, the optional input parameters val3 through val9 must be filled in ascending order without gaps.
The return value has the type string.



Latest notes:

The extremum functions nmax and nmin can be used to determine numeric extreme values.
Character-like extremum functions, like numeric extremum functions, can be traced back to the equivalent control structures using comparison 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 padding them with blanks.
As in comparisons with comparison operators, the current locale is not significant when determining the extreme values.
NON_V5_HINTS
ABAP_HINT_END

ABAP_EXAMPLE_VX5
The example demonstrates how to find the smallest and largest letters of a random set, which is represented here by the lines of an internal table. Of course, in this case the result can also be achieved by sorting the internal table, which is used here for verification.
ABEXA 00873
ABAP_EXAMPLE_END

ABAP_EXAMPLE_ABEXA
String functions cmax, cmin , and segment.
ABAP_EXAMPLE_END