Skip to content

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

off, len - Offset and Length

Other versions: 7.31 | 7.40 | 7.54

Syntax


... ( ... off = off len = len ...  ) ...

Effect

off is used to pass an offset and len is used to pass a length. In functions where both off and len can be passed, they determine the substring in which a string is to be edited.

off and len are numeric expression positions with the type i.

The default value of off is generally 0 and the default value of len is generally the length of the string minus a specified offset or an offset passed using off. Only in functions where a negative argument is passed for the occurrence occ (where possible) is the default value of off the length of the string and the default value of len the value of the associated offset.

If the value of off or len is negative, an offset defined using off is outside the string, or a substring defined using off and len is not fully contained in the string, an exception of the class CX_SY_RANGE_OUT_OF_BOUNDS is raised.


Example

The result of the following function calls is 17 and 12.

DATA(result1) = count( val = `Intro: blahblahblah` regex = `\w` ). 
DATA(result2) = count( val = `Intro: blahblahblah` regex = `\w` off = 6 ).