Get Example source ABAP code based on a different SAP table
Validity and Visibility The context of a declarative statement in the source code of a program determines the validity and visibility of the declared component. In ABAP programs, there are three contexts in which data types and data objects can be declared:
Locally in Procedures> Local data in procedures> is valid while a procedure is being executed. It is created when the procedure is called and deleted when the procedure is exited. In addition to their local data and formal parameters, procedures see the global data of the compilation unit>. Methods also 'see' the components of their class.
As Components of Classes> Static attributes> of classes exist for as long as the ABAP_ISESS > of the ABAP program exists. Instance attributes of classes are bound to the lifetime of objects. They are created when an object is instantiated and deleted along with the object by the Garbage Collector>. Classes also see the global data of the compilation unit.
Globally in the Compilation Unit> Global program data exists for as long as the ABAP_ISESS of the ABAP program exists. It is created when the program is loaded in the ABAP_ISESS , and deleted from the ABAP_ISESS when the program is removed. An ABAP program usually only sees its own global data BEGIN_SECTION VERSION 5 OUT (except for interface work areas >). END_SECTION VERSION 5 OUT All contexts see the program-independent type definitions of ABAP CDS, of the ABAP Dictionary and the type definitions and data declarations in the public visibility sections of global classes. Local declarations, however, hide global declarations with the same name. The following methods can be used to unhide these declarations:
In methods, components of classes can be addressed using an object component selector>.