Ansicht
Dokumentation

ABAPREPLACE_IN_POSITION - REPLACE IN POSITION

ABAPREPLACE_IN_POSITION - REPLACE IN POSITION

PERFORM Short Reference   BAL_S_LOG - Application Log: Log header data  
This documentation is copyright by SAP AG.
SAP E-Book

REPLACE SECTION OF

Short Reference



REPLACE SECTION $[OFFSET off$] $[LENGTH len$] OF dobj WITH new
                $[IN ${CHARACTER$|BYTE$} MODE$].

Addition:

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

Effect

In position-based replacements, the section in dobj is replaced starting at the offset specified in off for the length specified in len with the content of the operand new. The same applies to the additions OFFSET and LENGTH as to FIND SECTION OF.

Addition

... 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 performed. Depending on the processing type, dobj and new must be character-like or byte-like.

The statement FIND determines the offset and length of the first word "know" in the data objects text1 and text2 and to replace this section in a position-based manner in text1 and text2 with "should know that". After the first REPLACE statement, text1 contains the complete content "I should know that you know" and sy-subrc contains 0. After the second REPLACE statement, text2 contains the truncated content "I should know that" and sy-subrc contains 2.

Exceptions

Catchable Exceptions

CX_SY_RANGE_OUT_OF_BOUNDS

  • Cause: Specified offset or length violated the bounds of the string dobj.
    Runtime Error: REFI_WRONG_SECTION





CPI1466 during Backup   General Data in Customer Master  
This documentation is copyright by SAP AG.

Length: 2816 Date: 20240427 Time: 065647     sap01-206 ( 49 ms )