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

Former Member
0 Likes
658

singleton Concept:

I am planning to use Singleton class. But i am unclear about few things.

1. Instance created by one user by logining into the application(SAP) will be used by a different user(if the second user tries to get the instance) ?

2. Is the Singleton Class instance will be user login session specific. Meaning only 1 class instance for 1 user ?

Please provide your thoughts.

Cheers

RJ

1 ACCEPTED SOLUTION
Read only

FabioPagoti
Active Contributor
0 Likes
570

Hello Remo!

In fact your doubt is not related to the singleton design patter but the sap architecture.

When a user runs a report, it (the report) is assigned to a empty work process in the application layer. The work processes which are responsible to do this kind of task (run programs) are "self independent" (they even know the existence of other work processes of the same kind).

Program's variables (including instances) are stored in memory areas reserved for each work process.

So, it's not necessary to worry about this.

3 REPLIES 3
Read only

naimesh_patel
Active Contributor
0 Likes
570

Singleton object's visibility is only to that SESSION. If the same user starts a new session for the same application, he would get a new Singleton Object. Singleton object uses the same properties of the STATICS variable because to achieve the Singleton we need to use the STATIC attribute of that class. You may check this: [ABAP Objects Design Patterns - Singleton|http://help-abap.blogspot.com/2008/09/abap-object-design-patterns-singleton.html]

Regards,

Naimesh Patel

Read only

0 Likes
570

Hi RJ,

Naimesh describe exactly the point of the Singleton concept.

Further more your have the chance by using shared objects. There you can "save" a object through different programs.

http://help.sap.com/saphelp_sm32/helpdata/en/14/dafc3e9d3b6927e10000000a114084/frameset.htm

kind regards

Christian

Read only

FabioPagoti
Active Contributor
0 Likes
571

Hello Remo!

In fact your doubt is not related to the singleton design patter but the sap architecture.

When a user runs a report, it (the report) is assigned to a empty work process in the application layer. The work processes which are responsible to do this kind of task (run programs) are "self independent" (they even know the existence of other work processes of the same kind).

Program's variables (including instances) are stored in memory areas reserved for each work process.

So, it's not necessary to worry about this.