Singleton Class in OOABAP
Singleton Class in OOABAP
Overview
Sometimes in the real time business scenarios, we need
to have only one instance for a class, for this one we have
the concept of singleton in ABAP Objects
Definition
Singleton pattern is one of the simplest design
patterns which involves only one class which
instantiates itself to make sure that it creates one
instance.
Singleton ensues that it has only one instance and
provides global point of access to the object.
Implementation
Create a private class.
Add a private attribute with reference to the same class.
Create a public static method with returning value of
type reference to same class.
Create implementation and create object in the
implementation of public static method.
Call static method in any program to create instance for
the singleton class.
Thanking
You