Visibility of Data Objects
Data objects are always declared locally in a program. In terms of visibility, that is, their capacity to be addressed by name, a data object in ABAP can have local, global, or cross-program visibility.
-
Locally-visible data objects
are created within a
procedure (FORM or
FUNCTION) using a declarative
statement, and are visible within that procedure after the point at which they are defined. A locally-visible
object with the same name as a globally-visible object will obscure the global object within the procedure.
- Globally-visible data objects are created within a program, that is, anywhere but
in a procedure, using a declarative statement other than TABLES.
They are visible within that program after the point at which they are defined (as long as they are not obscured in a procedure by a local data object with the same name).
-
A data object has
cross-program visibility
if it is defined using TABLES
or DATA ... COMMON PART in a program. It is visible globally
within the program from the point at which it is defined. In this respect, it is the same as a globally-visible
object. However, the object is also placed in the cross-program memory that is shared at runtime by all programs that contain a corresponding data defintion.