Introduction
This chapter explores recipes related to ABAP objects. Two useful features of the object-oriented ABAP are storage options in the shared memory as shared objects, and in the database as objects of persistent classes. The details about both the prerequisites as well as the necessary steps needed to created shared memory-enabled objects and persistent objects will be discussed later in this chapter.
Moreover, design patterns are very important in object-oriented programming. In this chapter, we will see how to implement three of them using ABAP objects, namely the adapter, singleton
, and the factory design. We will create a class with a factory
method design. Later, we will show how this class may be modified in order to behave like a singleton class. Finally, we will see how an object of one class may be converted to that of another using an adapter class. The examples are kept simple in order to emphasize on the design pattern concept.
For this chapter, we assume that the reader has basic knowledge of the ABAP objects, and is familiar with the class-builder transaction.