ABAP length for strings
There are two operator for string length in ABAP:
numofchar( lv_var )
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( lv_var )
Number of characters in arg, where trailing blanks in data objects with fixed lengths are not counted. They are counted though in data objects with the type string.
This example further clarifies the situation. In most cases you will likely want to use numofchar to get the minmal string length without trailing spaces.
DATA: lc_string TYPE string VALUE ` Test `,
lc_chars(7) TYPE c VALUE ` Test `.
WRITE:/ |numofchar: { numofchar( ` Test ` ) }|. "5
WRITE:/ |strlen: { strlen( ` Test ` ) }|. "7
WRITE:/ |numofchar: { numofchar( lc_string ) }|. "5
WRITE:/ |strlen: { strlen( lc_string ) }|. "7
WRITE:/ |numofchar: { numofchar( lc_chars ) }|. "5
WRITE:/ |strlen: { strlen( lc_chars ) }|. "5