SAP count characters in ABAP variable

Example. With STRLEN you can count characters in variable with ABAP

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 funcReturn Value
charlenLength 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;
dbmaxlenMaximum 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.
numofcharNumber 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.
strlenNumber 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 functions that can also be used in the extended functional operand positions of the statements MOVE, CASE, and WHEN

REPORT ZSTRLEN.

DATA : STRING TYPE STRING.
DATA LV_LENGTH TYPE I . "variable to store length
STRING = 'THIS IS SOME STRING'.
LV_LENGTH = STRLEN( STRING ).
WRITE : LV_LENGTH. "out put will be 19