ABAP Keyword Documentation → ABAP − Reference → Processing Internal Data → Character String and Byte String Processing → Expressions and Functions for String Processing → String Functions → Description Functions for Character-Like Arguments
charlen, dbmaxlen, numofchar, strlen - Length Functions
These length functions have an unnamed character-like argument.
Other versions: 7.31 | 7.40 | 7.54
Syntax
... func( arg ) ...
Effect
The following table shows the length functions with one unnamed argument. The arguments arg
of all length functions except dbmaxlen
are
character-like expression positions. The argument of dbmaxlen
is a character-like
functional operand position. The return code has the type i
for all length functions.
Function func | Return Value |
---|---|
charlen |
Length of first character of arg in thecode page used: 1 for a single Unicode character; 2 forsurrogate pairs. |
dbmaxlen |
Maximum length of a string defined in ABAP Dictionary (RAWSTRING, SSTRING, STRING, or GEOM_EWKB).If the string is unrestricted, the constant abap_max_db_string_ln or abap_max_db_rawstring_ln from thetype group ABAPis returned. The latter is also returned for the built-in ABAP types string and xstring . |
numofchar |
Number of characters in arg , where trailing blanks are not counted in data objects with fixed lengths or in data objects with the type string . |
strlen |
Number of characters in arg , where trailing blanks in data objects withfixed lengths are not counted. They are counted though in data objects with the type string . |
Note
The functions described here are some of the functions that can be used in the obsolete extended functional operand positions, even if their argument is a single data object.
Example
The results of the following length determinations are 10 and 5.
DATA:
str TYPE string VALUE `12345 `,
txt TYPE c LENGTH 10 VALUE '12345 '.
cl_demo_output=>display( |{ strlen( str )
}, { strlen( txt ) }| ).