The ABAP function STRLEN returns the length of a string up to the last character that is not a space.
[COMPUTE] <n> = STRLEN( <c> ).
STRLEN processes any operand <c> as a character data type, regardless of its real type. There is no type conversion.
As with
mathematical functions, the keyword COMPUTE is optional.
DATA: INT TYPE I,
WORD1(20) VALUE '12345'.
WORD2(20).
WORD3(20) VALUE ' 4 '.
INT = STRLEN( WORD1 ). WRITE INT.
INT = STRLEN( WORD2 ). WRITE / INT.
INT = STRLEN( WORD3 ). WRITE / INT.
The results are