Skip to content

ABAP Keyword Documentation →  ABAP - Quick Reference 

REPLACE - Quick reference

Reference

Other versions: 7.31 | 7.40 | 7.54

Syntax


REPLACE { { [{FIRST OCCURRENCE}|{ALL OCCURRENCES OF}] 
            {[SUBSTRING] substring} | {REGEX regex} IN
            { {[SECTION [OFFSET off] [LENGTH len] OF] dobj}
            | {TABLE itab [FROM lin1 [OFFSET off1]]
                          [TO   lin2 [OFFSET off2]]} }
            WITH new
            [IN {CHARACTER|BYTE} MODE]
            [{RESPECTING|IGNORING} CASE]
            [REPLACEMENT COUNT  rcnt]
            { {[REPLACEMENT OFFSET roff]
               [REPLACEMENT LENGTH rlen]
               [REPLACEMENT LINE   rlin]}
            | [RESULTS result_tab|result_wa] } }
        | { SECTION [OFFSET off] [LENGTH len] OF dobj
            WITH new
            [IN {CHARACTER|BYTE} MODE] } }.

Effect

Replaces character strings or byte strings in a character-like or byte-like data object dobj or in an internal table itab with the content of new. Determines the characters or bytes to be replaced using a search for substrings or regular expressions or by specifying the offset and length directly.

Additions