0% found this document useful (0 votes)
95 views

Singleton Class in OOABAP

The singleton pattern ensures that only one instance of a class is created. It involves creating a private class with a private attribute that references the class itself. A public static method returns a reference to the singleton instance, creating it if needed. Calling this method from any program returns the single instance.

Uploaded by

joga srikanth
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
95 views

Singleton Class in OOABAP

The singleton pattern ensures that only one instance of a class is created. It involves creating a private class with a private attribute that references the class itself. A public static method returns a reference to the singleton instance, creating it if needed. Calling this method from any program returns the single instance.

Uploaded by

joga srikanth
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 5

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

You might also like