ABAP STRLEN - String length

ABAP has several expressions for working with string lengths. Let's analyze these functions in more detail. All functions presented have one nameless argument and are used as follows:

strlen( lv_arg )
charlen( lv_arg )
dbmaxlen( lv_arg )
numofchar( lv_arg )

Example of calling string length functions in ABAP:

Длина строки ABAP Длина строки ABAP

Let's consider in more detail each of the methods:

strlen (abap) - This function returns the number of characters in the abap argument. In this case, trailing spaces in a fixed-length string are not taken into account, but in objects of the string type are taken into account. This is the most commonly used function to get the length of a string.

numoflen (abap) - This function will return us the number of characters of the abap argument, where trailing spaces are not taken into account for any type of argument.

charlen (abap) - Returns the length of the first character of the abap argument in the used codepage.

dbmaxlen (abap) - Returns the maximum string length described in the ABAP dictionary. If it is a string with unlimited length, the function returns the abap_max_db_string_ln or abap_max_db_rawstring_ln constant depending on the type of argument passed.