OVERLAY is a keyword used in SAP ABAP programming.This tutorial covers its introduction & syntax details.
OVERLAY
Basic form
OVERLAY c1 WITH c2.
Addition
... ONLY c3
Effect
The contents of the field c2 overlay the field c1 in all positions where c1 has the value SPACE ; c2 itself remains unchanged.
The return code value is set as follows:
SY-SUBRC = 0 At least one character in c1 is overlaid by a character from c2 .
SY_SUBRC = 4 No character in c1 was overlaid by a character from c2 .
Example
DATA: WORK(20) VALUE 'Th t h s ch ng d.',
HELP(20) VALUE 'Grab a pattern'.
OVERLAY WORK WITH HELP.
WORK now contains ' That has changed. ' and the system field SY-SUBRC is set to 0.
Note
If c1 is longer than c2 , c1 is only overlaid by the length of c2 . The result for overlapping fields c1 and c2 is undefined.
Addition
... ONLY c3
Effect
The
contents of the field c2 overlay the field c1 only in those positions
where c1 has one of the characters existing as a value in c3 ; the
fields c2 and c3 remain unchanged.
Example
Linking field selection templates:
DATA: ONE(16), TWO(16).
ONE = '----****++++....'.
TWO = '-*+.-*+.-*+.-*+.'.
OVERLAY ONE WITH TWO ONLY '.'.
OVERLAY TWO WITH ONE ONLY '.+'.
OVERLAY ONE WITH TWO ONLY '+*'.
Field ONE now contains '-----***-*++-*+.' and field TWO contains '-*---***-*++-*+.' .
Note
Performance
The
runtime required for the OVERLAY command in the example of the basic
form is about 45 msn (standardized microseconds). To execute the
addition ... ONLY c3 , about 40 msn are needed.
Related 10 ABAP Syntax Tutorials
Most readed SAP Tutorials
- WRITE - Output to a list ( SAP ABAP Keyword)
WRITE ( Output to a list ) is a keyword used in SAP ABAP programming.This tutorial covers its introduction & syntax details. - List of SAP HR TABLES and Infotypes tables
Detailed full list of tables and infotypes used in SAP HR module. - List of SAP MM Transaction codes
This documentation covers the details of SAP MM Transaction codes - SELECT-OPTIONS ( SAP ABAP Keyword)
SELECT-OPTIONS is a keyword used in SAP ABAP programming.This tutorial covers its introduction & syntax details. - FI Accounts Receivable and Accounts Payable | SAP FI PDF manual
The following topics are an introduction to the Accounts Receivable and Accounts Payable application components. - SELECT clause ( SAP ABAP Keyword)
SELECT clause is a keyword used in SAP ABAP programming.This tutorial covers its introduction & syntax details. - SAP MM Process Flow
The typical procurement cycle for a service or material consists of the following phases:
Latest Added SAP documents
- 9KE9 Transaction code
Details about SAP transaction code 9KE9 - 9KE8 Transaction code
Details about SAP transaction code 9KE8 - 9KE7 Transaction code
Details about SAP transaction code 9KE7 - 9KE6 Transaction code
Details about SAP transaction code 9KE6 - 9KE5 Transaction code
Details about SAP transaction code 9KE5 - 9KE4 Transaction code
Details about SAP transaction code 9KE4 - 9KE3 Transaction code
Details about SAP transaction code 9KE3 - 9KE2 Transaction code
Details about SAP transaction code 9KE2 - 9KE1 Transaction code
Details about SAP transaction code 9KE1 - 9KE0 Transaction code
Details about SAP transaction code 9KE0