Ansicht
Dokumentation

ABAPREPLACE_OBSOLETE - REPLACE OBSOLETE

ABAPREPLACE_OBSOLETE - REPLACE OBSOLETE

BAL_S_LOG - Application Log: Log header data   Vendor Master (General Section)  
This documentation is copyright by SAP AG.
SAP E-Book

REPLACE substring WITH

Short Reference



REPLACE substring WITH new INTO dobj
        $[IN ${BYTE$|CHARACTER$} MODE$]
        $[LENGTH len$].


Additions

1. ... IN ${CHARACTER$|BYTE$} MODE

2. ... LENGTH len

Effect

This statement searches a character string or byte chain dobj for the substring specified in substring and replaces the first character string or byte string in dobj that matches substring with the content of the data object new.

The memory areas of substring and new must not overlap, otherwise the result is undefined. If substring is an empty string, the position in front of the first character or byte of the search range is found and the content of new is inserted in front of the first character.

If the length of the intermediate result is longer than the length of dobj, data objects with fixed lengths are truncated on the right. If the length of the intermediate result is shorter than the length of dobj, data objects of fixed length are padded on the right with blanks or hexadecimal zeros. Data objects of variable length are adjusted accordingly.

In character string processing, the trailing blanks are respected for data objects dobj, substring, and new of type c, d, n, or t.

System Fields

sy-subrc Meaning
0 The substring in substring was replaced in the target field dobj by the content of new.
4 The substring in substring could not be replaced in the target field dobj by the content of new.

Note

This variant of the REPLACE statement has been replaced by the variant REPLACE.

Addition 1

... IN ${CHARACTER$|BYTE$} MODE

Effect

The optional addition IN ${CHARACTER$|BYTE$} MODE determines whether character string or byte string processing is performed. 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.

Addition 2

... LENGTH len

Effect

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.

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".






General Data in Customer Master   Fill RESBD Structure from EBP Component Structure  
This documentation is copyright by SAP AG.

Length: 4282 Date: 20240427 Time: 014908     sap01-206 ( 82 ms )