Class Pools and Interface Pools in SAP ABAP

by | Jul 26, 2020 | OOABAP

Home » SAP » ABAP » OOABAP » Class Pools and Interface Pools in SAP ABAP

Preface – This post is part of the Object Oriented ABAP series.

Introduction

So far we have learnt about the classes and interfaces, their properties, uses and many more things. We can define the class and interface either globally in the repositories or locally in the ABAP program. When the classes and interfaces are defined globally, class pools and interface pools generated by CLASS BUILDER serves as a container and each class pool and interface pool contains a single class or interface. The benefit of defining globally is that they can be accessed by any ABAP program. Whereas when defining locally, they are accessed only by their own program.

Class Pools

A class pool acts as the container for classes defined globally and has program type K. It is somewhat similar to module pools or function groups (act as containers) except the fact that the class pools don’t have their own screens or processing blocks than methods. It contains both declarative as well as executable statements. The CREATE OBJECT statement creates the objects to execute the statements in class pools.

The class pool is introduced by the statement CLASS-POOL in master program. The naming of the master program will contain the global class name and is padded with “=” up to 30th position and ends with “CP”.

Example, The name of the interface pool for global interface CL_DEMO_GO_CODING is CL_DEMO_GO_CODING=============CP.

Structure of Class Pool
Below is the structure of Class Pools:

Class Pools and Interface Pools in SAP ABAP

The types defined in the class pool are only visible in the implementation part of the global class.

Interface Pool

An interface pool acts as the container for interfaces defined globally and has program type J. Unlike the class pools, interface pools do not have any executable statements. They contain the interface definition which can be implemented by global and local classes.  When interfaces are implemented in global class, the interface definition is also included in the class definition.

Similar to class pool, the name of the master program of interface pool contains the global interface name and is padded with “=” up to 30th position and ends with “IP”.

The name of the interface pool for global interface IF_DEMO_GO_CODING is IF_DEMO_GO_CODING=============IP.

Author

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Author