ABAP Keyword Documentation → ABAP − Reference → Processing Internal Data → Internal Tables → Processing Statements for Internal Tables → REPLACE IN TABLE itab
REPLACE IN TABLE - table_range
Other versions: 7.31 | 7.40 | 7.54
Syntax
... [FROM lin1 [OFFSET off1]] 
    [TO   lin2 [OFFSET off2]] ... 
Effect
This addition restricts the search performed by the statement REPLACE IN TABLE on the table section specified in the
numeric expression
positions lin1, off1, lin2,
and off2. The syntax and semantics are the same as for the statement FIND.  
Example
The following replacement creates the result shown below. Note that the OFFSET addition of TO defines the end of the replacement range.
TYPES: 
  BEGIN OF line, 
    col1 TYPE c LENGTH 5, 
    col2 TYPE c LENGTH 5, 
  END OF line, 
  itab TYPE STANDARD TABLE OF line WITH EMPTY KEY. 
DATA(itab) = VALUE itab( FOR i = 1 UNTIL i > 5 
                       ( col1 = 'abcde' col2 = 'abcde' ) ). 
REPLACE ALL OCCURRENCES OF `cd` 
        IN TABLE itab 
        FROM 2 OFFSET 5 
        TO   4 OFFSET 5 
        WITH 'XX'. 
cl_demo_output=>display( itab ).
Result:
| COL1 | COL2 | 
|---|---|
| abcde | abcde | 
| abcde | abXXe | 
| abXXe | abXXe | 
| abXXe | abcde | 
| abcde | abcde |