SAP NetWeaver AS ABAP Release 740, ©Copyright 2014 SAP AG. All rights reserved.
ABAP Keyword Documentation → ABAP − Reference → Processing Internal Data → Character String and Byte String Processing → Expressions and Functions for String Processing → String Functions → Processing Functions for Character-Like Arguments →insert- Insert Function
Syntax
... insert( val = text sub = substring [off = off] ) ...
Effect
This function inserts the character string specified in substring in the string specified in text, either before the first character or at the optional offset specified off and returns the result. If substring is empty, the unchanged content of text is returned.
The return code has the type string.
Example
After the following loop is executed, the result is in result "X X X X X".
DATA result TYPE string VALUE `XXXXX`.
DO strlen( result ) - 1 TIMES.
result = insert( val = result sub = ` ` off = sy-index * 2 - 1 ).
ENDDO.
Catchable Exceptions
CX_SY_RANGE_OUT_OF_BOUNDS