[ABAP] Strings ersetzen

* Variante 1 (REPLACE, alle Vorkommen von '!' mit '.')
DATA: s TYPE string VALUE 'Test!'.
REPLACE ALL OCCURRENCES OF '!' IN s WITH '.'.
WRITE: / s.

* Variante 2 (replace, 1 Zeichen an der Stelle 4)
DATA(res) = replace( val = 'Test!' off = 4 len = 1 with = '.' ).
WRITE: / res.

* Variante 3 (replace, das erste Vorkommen von '-')
DATA(rep) = replace( val = '1-2' sub = '-' with = '+' ).
WRITE: / rep.

* Variante 4 (replace, alle Vorkommen von '*')
DATA(rep) = replace( val = '*test*' sub = '*' with = '%' occ = 0 ).
WRITE: / rep.