After writing the Basic Concepts – The Pain With Using Singleton Context Nodes about the usage of singleton context nodes in Web Dynpro ABAP, I received some questions by email. Since I found them useful in a sense that other developers might have similar questions, I would like to take the opportunity to answer them in blog.
Q: You mentioned that certain ui elements (e.g. the Tree) don’t work with singleton nodes. To me this sounds like a bug. If so, why don’t you fix it?
A: First off, it’s not a bug. Actually, the context behaves exactly as it was set up and according to how singleton context nodes are expected to behave. The tree displays this context structure perfectly as well. Let me explain it on an example. I am aware that it has its shortcomings, but I believe it describes the situation quite well from a beginners perspective. Using a tree ui element together with singleton context nodes is a bit like flagging a number of classes as static and trying to display them as a tree. The result will always be a line or a tree that behaves as described in the other blog, because there is only a single “instance” for each type of entity.
Q: Will you enhance the design time checks to detect combinations of ui elements and singleton nodes that don’t go along very well?
A: We are constantly improving the design time checks to make it easier and more convient for developers to create Web Dynpro ABAP applications. So the answer is clearly a yes.
Q: What is the suggestion? Should I switch the singleton flag off or on?
A: If you are a beginner or uncertain about if singleton context nodes are benefitial for your scenario, it’s best to switch off of the flag.
Q: Are you deliberating to change the default in the workbench?
A: Yes, although there is the compatibility issue, which we have to take care of. This means that we are looking for ways to change the default, but at this moment can’t definitely confirm that we will be able to change it.
Q: Is there any situation where using singleton context nodes makes sense?
A: Of course! Suppose you have a context with a very large number of nodes nested in a deep hierarchy. Using supply functions and having a user who accesses a large portion of the tree while working with the application will lead to effect that the memory consumption of the application will increase over time. In case there is a memory bottleneck at the application server (i.e. due to many users doing the same thing), using singleton context nodes can improvde the performance. This is something one should test though by comparing both versions of an application and then make a decision on the data gathered.
I hope, this answers some of the questions.