Statements in Class and Interface Pools

Class and interface pools are the ABAP programs of the class library. They are exclusively defined with the Class Builder of the ABAP Workbench and are used to store global classes and interfaces. Class pools have the program type K, while interface pools have the program type J. A class pool can contain only one global class, and an interface pool can contain only one global interface.

Like any other ABAP program, class and interface pools consist of a global declaration section and processing blocks. The global declaration part of a class pool is made up of a definition section in which you can define data types, interfaces and classes local in the program, and the actual declaration section of the global class. The global declaration section of an interface pool consists only of the definition of the global interface.

In class and interface pools, you use the statements for defining classes and interfaces to define the local and global classes or interfaces. Outside the definition of classes and interfaces, you can only use the following statements:

Statements in Class Pools

Statement for Declaring Type Groups

TYPE-POOLS ...

Use this statement to declare type groups from the ABAP Dictionary. From this point onwards, you can refer to the corresponding types anywhere in the class pool.

Statement for Defining Types Local in the Program

TYPES ...

Use this statement to define data types local in the program. These types are only visible in the implementation section of the global class.

Statements in Interface Pools

Statement for Declaring Type Groups

TYPE-POOLS ...

Use this statement to declare type groups from the ABAP Dictionary to use them in the interface for typing components. In interface pools, however, you cannot define types local in the program.

Notes

Besides the statements above, no other statements are necessary outside CLASS - ENDCLASS and INTERFACE - ENDINTERFACE and are therefore not permitted. The statements permitted are subject to the restricted syntax rules of ABAP Objects.

This has the following effects:

You are not allowed to use event blocks like START-OF-SELECTION, AT SELECTION-SCREEN,GET or AT LINE-SELECTION, dialog modules defined by MODULE - ENDMODULE, or function modules and subroutines defined by FUNCTION - ENDFUNCTION and FORM - ENDFORM. This means that the events of the runtime environment cannot be processed. ABAP Objects has its own event concept. Procedures that are not methods can only be called externally in the methods of global classes. In methods of local classes, however, the procedures of the main program can also be called internally.
You are not allowed to use the statements TABLES and NODES and the addition COMMON PART of the DATA statement. This means that class and interface pools do not support cross-program global data areas within an internal mode.
Screen processing common in other ABAP programs is not supported. You cannot define list and selection screens in a class or interface pool. There are plans to integrate screens with ABAP Objects in the future. Although you can call the screens of the main program using CALLSCREEN or CALL SELECTION-SCREEN, and describe the lists of the main program with output statements in locally defined classes, screen processing using dialog modules or event blocks nevertheless takes place in the main program.