sapdev logo background
sapdev logo sapdev logo
Comments

SAP INSERT FUNCTIONS documentation, setup help and example usage



Return to SAP documentation index


ARTICLE

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.



Runtime Exceptions

Catchable Exceptions
CX_SY_RANGE_OUT_OF_BOUNDS
Reason for error: Invalid offset specified in places .
Runtime error: STRING_OFFSET_TOO_LARGE
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved








comments powered by Disqus