SAP NetWeaver AS ABAP Release 740, ©Copyright 2014 SAP AG. All rights reserved.
Lifetime of Data Objects
The validity and lifetime of data objects can be divided into static, automatic, and dynamic validity and lifetime as follows:
- A data object has static validity, that is, its lifetime is bound to that of the program, if it is created in a program, or within a
procedure using the
STATICS statement. Data objects with static validity are created in a global data area.
- A data object has automatic validity, that is, its lifetime is bound to
the activity of the procedure in which it was created, if it is created in a procedure with a declarative
statement other than STATICS. Data objects with automatic validity are created
new on the stack each time the procedure is called in which they are defined. They are released automatically when the procedure ends (hence the term "automatic validity").
- A data object has dynamic validity, that is, a lifetime controlled by
the program, if it is created and deleted by operational statements in a program. In ABAP, the contents of internal tables and strings have dynamic validity. These data objects are created on the heap.