‎2010 Mar 25 3:42 PM
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
‎2010 Mar 29 5:01 PM
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.
‎2010 Mar 25 3:46 PM
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
‎2010 Mar 26 9:11 AM
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
‎2010 Mar 29 5:01 PM
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.