dobj , the object is truncated on the right in the case of data
objects of fixed length. If the length of the interim result is shorter
than the length of dobj , data objects of fixed length are padded
on the right with blanks or hexadecimal zeroes. Data objects of variable
length are adjusted accordingly.
In character string processing, the trailing blanks are not ignored
for data objects dobj , substring , and new of type
c , d , n , or t .
System fields
sy-subrc Meaning
0The substring in substring was replaced in the target field
dobj by the content of new .
4The substring in substring could not be replaced in the
target field dobj by the content of new .
Latest notes: This variant of the REPLACE statement has been
replaced by the variant REPLACE .
ABAP_ADDITION_1 ... IN {CHARACTER|BYTE} MODE
What does it do? The optional IN {CHARACTER|BYTE} MODE addition
determines whether character
string or byte string processing is carried out. If the addition is
not specified, character string processing is carried out. Depending on
the processing type, the data objects substring , new , and
dobj must be character-like or byte-like.
ABAP_ADDITION_2 ... LENGTH len
What does it do? If the addition LENGTH is not specified, all the
data objects involved are evaluated in their entire length. If the
addition LENGTH is specified, only the first len
characters or bytes of substring are used for the search. len
expects a data object of the type i .
Example ABAP Coding After the replacements, text1 contains the
complete content "I should know that you know", while text2 has
the cut-off content "I should know that".
DATA: text1 TYPE string VALUE 'I know You know',
text2 TYPE c LENGTH 18 VALUE 'I know You know',
substring TYPE string VALUE 'know',
new TYPE string VALUE 'should know that'.
REPLACE substring WITH new INTO text1.
REPLACE substring WITH new INTO text2.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved