Statically-Declared and Dynamically-Created Data Objects
There are two kinds of data objects: those that are declared statically,and those that are created dynamically.
- Any data object that you declare using a declarative statement is statically declared,
regardless of its visibility, validity and structure, whether or not it can be changed, or addressed symbolically. Statically-declared data objects are administered when the program is generated.
-
The lines in an internal table are
created dynamically by the APPEND,
COLLECT, and INSERT statements.
-
Data objects with type
STRING and XSTRING
are also dynamic. They have initial length when the are declared; the memory that they use is assigned dynamically.
-
ASSIGN LOCAL COPY OF f TO <fs> allows you to create data objects dynamically on the stack.
Since the dynamic validity of local internal tables and dynamic stack extensions is restricted to the
lifetime of the defining procedure, the corresponding resources are released automatically by the ABAP
runtime system when the procedure ends. This means that you do not normally need to include memory management
in your ABAP programs. However, you can release space occupied by an internal table using
DELETE
to delete individual lines, or REFRESH
or FREE to delete a whole table.