OVERLAY text1 WITH text2 [ONLY pattern].
Characters in the text1 variable are replaced by characters in the text2 data object which are there in the same location. If the ONLY addition is not specified, all blank characters in text1 are replaced. If the ONLY addition is specified, all characters are replaced that occur in the pattern data object, and upper and lowercase is taken into consideration. If the lengths of text1 and text2 are different, text1 is processed using the shorter length only.
The text1, text2
and pattern data objects have to be character-type. In
data objects of fixed length, closing blank characters are taken into consideration. If pattern is an empty string, no replacements are made.
System fields
sy-subrc | Meaning |
0 | At least one character in text1 is replaced. |
4 | No characters are replaced in text1. |
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".
CONSTANTS initial_time TYPE t VALUE IS INITIAL.
DATA: time TYPE t,
text TYPE c LENGTH 4.
text = '12'.
time = text.
OVERLAY time WITH initial_time.