Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Processing Internal Data →  Character String and Byte String Processing →  Expressions and Functions for Byte String Processing →  Byte String Functions 

xstrlen - Length Function

One length function is currently available for unnamed byte-like arguments.

Other versions: 7.31 | 7.40 | 7.54


... xstrlen( arg ) ...

The function xstrlen returns the number of bytes in arg. The argument arg is a byte-like functional operand position. The return value has the type i.


The function described here is one of the functions that can be used in the obsolete extended functional operand positions, even if its argument is a single data object.


A six-character text in the code page UTF-16 is represented by 12 bytes.

DATA(text) = `Hello!`. 
DATA(hex) = cl_abap_conv_codepage=>create_out( codepage = `UTF-16` 
             )->convert( text ). 
  |Text length {   strlen( text ) 
  }\nByte length { xstrlen( hex )  }| ).