SAP CLASS INTERACE POOLS



Get Example source ABAP code based on a different SAP table
  



ABAP_OBJ - Statements in Class Pools and Interface Pools
Class pools and interface pools are the ABAP programs in the class library. They are defined in the ABAP Development Tools (ADT)
BEGIN_SECTION VERSION 5 OUT or using the Class Builder tool in the ABAP Workbench
END_SECTION VERSION 5 OUT and are used as a repository for global classes and interfaces.
BEGIN_SECTION VERSION 5 OUT
A program of program type class pool is introduced using the statement CLASS-POOL.
A program of program type interface pool is introduced using the statement INTERFACE-POOL.
END_SECTION VERSION 5 OUT
BEGIN_SECTION VERSION 5 OUT
These statements are generated by the Class Builder.
END_SECTION VERSION 5 OUT
Each class pool or interface pool can only contain one global class or a single global interface. These classes or interfaces are declared using the following statements:
CLASS ... PUBLIC. ... ENDCLASS.
INTERFACE ... PUBLIC. ... ENDINTERFACE.
BEGIN_SECTION VERSION 5 OUT
The Class Builder uses the properties entered here to generate these statements.
END_SECTION VERSION 5 OUT

Further Statements in Class Pools
In addition to the declaration of the global class, a class pool can only contain the following statements:
Declaration of local data types using the statement TYPES. These data types can be used by the global class in the private visibility section and in the implementation part.
Declaration of local constants using the statement CONSTANTS. These data types can be used by the global class in the private visibility section and in the implementation part.
Declaration of local interfaces using the statements INTERFACE ... ENDINTERFACE. These can be used by the global class in the private visibility section and in the implementation part.
Declaration and implementation of local classes using the statements CLASS ... ENDCLASS. These can be used by the global class in the private visibility section and in the implementation part.
BEGIN_SECTION VERSION 5 OUT
Definition of macros using DEFINE ... END-OF-DEFINITION. These macros can be used by the global class in the implementation part.
END_SECTION VERSION 5 OUT
Locally defined types, classes, and interfaces in class pools can be used in the following ways:
Only the methods of the global class access the local declarations and implementations in the program. These provide auxiliary methods, for example, which should not be visible in the interface of the global class. This is the most common scenario. Any changes made to local declarations in the program do not affect the interface of the global class.
Apart from the methods of the global class, declarations in the private visibility section of the class also refer to the local declarations in the program. This is a more unusual scenario, in which changes made to the local declarations affect the interface of the global class and subclasses, and friends of the global class are recompiled before the next execution.

Further Statements in Interface Pools
In addition to the declaration of the global interface, an interface pool cannot contain its own declarations or implementations.
BEGIN_SECTION VERSION 5 OUT The obsolete statement TYPE-POOLS is also syntactically possible.
END_SECTION VERSION 5 OUT

Program Organization
Like any other ABAP program, class and interface pools consist of a global declaration part for declarations and an implementation part for implementations (procedures).
The global declaration part of a class pool can therefore contain the declarations of local data types, local interfaces, and local classes, in addition to the actual declaration part of the global class. The implementation part of a class pool can contain the implementation parts of local classes in addition to the implementation part of the global class.
The global declaration part of an interface pool can only contain the declaration of the global interface and the implementation part of an interface pool is always empty.
The ABAP Development Tools (ADT)
BEGIN_SECTION VERSION 5 OUT or Class Builder
END_SECTION VERSION 5 OUT organize the various declarations and implementations of a class or