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.

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 the code page used: 1 for non-Unicode single-byte code; 1 or 2 for non-Unicode double-byte code; 1 for Unicode with simple Unicode character; 2 for Unicode with surrogates;
dbmaxlen Maximum length of a string defined in ABAP Dictionary (RAWSTRING, SSTRING, STRING). If the string is unrestricted, the constant abap_max_db_string_ln or abap_max_db_rawstring_ln from the type group ABAP is returned. The latter is also returned for the predefined ABAP types string and xstring.
numofchar Number of characters in arg, where closing blanks are not counted in data objects with fixed lengths or in data objects with the type string. If a non-Unicode double-byte code is used, a character that uses two bytes is only counted once.
strlen Number of characters in arg, where closing blanks in data objects with fixed lengths are not counted. They are counted though in data objects with the type string. If a non-Unicode double-byte code is used, a character that uses two bytes is counted twice. The argument can be byte-like outside Unicode programs.

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.