Get Example source ABAP code based on a different SAP table
• SECTION OF REPLACE • OFFSET REPLACE • LENGTH REPLACE
REPLACE SECTION OF> Short Reference >
ABAP_SYNTAX REPLACE SECTION $[OFFSET off$] $[LENGTH len$] OF dobj WITH new> $[IN ${CHARACTER$|BYTE$} MODE$].>
ABAP Addition ... IN ${CHARACTER$|BYTE$} MODE>
What does it do? 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>>. • IN BYTE MODE REPLACE SECTION OF • IN CHARACTER MODE REPLACE SECTION OF
ABAP Addition
What does it do? 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.
ABAP_EXAMPLE_VX5 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. ABEXA 00549 ABAP_EXAMPLE_END
Runtime Exceptions
Catchable Exceptions CX_SY_RANGE_OUT_OF_BOUNDS>>
Reason for error:
Specified offset or length violated the bounds of the string dobj>.