Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Singleton with parameters in ABAP

Former Member
0 Likes
1,329

Hi all

I would like to know, how can I create a singleton class pattern with parameters?

In other programming language I can overload the class-constructor but since in ABAP overloading a method is not possible, how can I pass the parameters?

Thanks

3 REPLIES 3
Read only

Muthu_raja
Active Participant
0 Likes
885

Hi Anujit,

Why do you want to pass a parameter to the singleton class constructor ??. Can you please elaborate it ??..

Read only

Sandra_Rossi
Active Contributor
885

This has already been answered several times in the forum: use optional parameters to mimic the overloading. Be careful when you use the term "class constructor", it has a special meaning in ABAP (it can't have any parameter), so I guess you mean simply "constructor".

Read only

matt
Active Contributor
885

A class-constructor in ABAP is like a static class initialiser in Java.