SAP LENGTH FUNCTIONS ARGS

Get Example source ABAP code based on a different SAP table
  


ARTICLE
• char_off ABAP_FUNCTION

char_off - Length Function
This length function has a named character-like argument.

Syntax
... char_off( val = text add = pos [off = off] ) ...

Effect
The function returns the offset of the character in text that is pos places away from the character in the offset specified in off. The default value for off is 0. text is a character-type expression position. pos and off are numerical expression positions with the type i.
This function can be specified in general and numeric expression positions. The return value has the type i.
The value of pos can be positive and negative and has the appropriate number of places on the right or on the left. If pos identifies a positions outside of text, the function returns the value -1. If off is greater than the length of text, an exception of the class CX_SY_RANGE_OUT_OF_BOUNDS is raised.

Note
The function char_off is suitable for finding the correct offsets of characters in non-Unicode double-byte systems.

Example
The following call gets the offset off in a non-Unicode double-byte system, plus the number of bytes for the character located in the position of off. ... char_off( val = text add = 1 off = off ) ...