Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Processing Internal Data →  Character String and Byte String Processing →  Statements for Character String and Byte String Processing 


Short Reference

Other versions: 7.31 | 7.40 | 7.54


OVERLAY text1 WITH text2 [ONLY mask]. 


Characters in the variable text1 are replaced by the characters in the operand text2 that are in the same position there. text2 is a character-like expression position.

If the ONLY addition is not specified, all blank characters in text1 are replaced. If the addition ONLY is specified, all characters are replaced that occur in the operand mask. This is case-sensitive. mask is also a character-like expression position.

If the lengths of text1 and text2 are different, text1 is processed using the shorter length only.

The text1, text2, and mask operands have to be character-type. In operands of fixed length, closing blank characters are taken into consideration. If mask is a blank string, no replacements take place.

System Fields

sy-subrc Meaning
0 At least one character in text1 is replaced.
4 No characters in text1 are replaced.


After the text field has been assigned to the time field, it contains the invalid tome "12 00" according to the conversion rules. As a result of the overlay with the initial_time constants, the two blank characters are replaced by "00" and the result is the valid time "120000".

DATA: time        TYPE t, 
      text TYPE c LENGTH 4. 

text = '12'. 
time = text. 
OVERLAY time WITH initial_time.