SAP OSS Note 999992 version 0004 contains details of a know issue related to WD ABAP: Analyzing context problems . This includes any associated symptoms and instructions on how to fix it, see below for full details. Also check out the comments section to view/add related contributions, questions or screen shots, based on real life experience of this oss note and problem.
...For more information about the SAP support system known as OSS please check out the SAP OSS NOTES SECTION, whih includes how to download & implement them onto your SAP system using transaction code SNOTE.
When you access the context either with your own code or by displaying
UI elements, short dumps are generated, indicating that you can
not access context nodes or context attributes.
Cause of the problem and Pre-requisites
There are numerous reasons for erroneous access to the context.
The following section describes some of the main reasons:
Reasons why a context node cannot be found
The node is deeply embedded in the hierarchy and a higher-level node is
empty because, for example, the business logic did not return
any data. A lower-level node is not created in this case.
A higher-level node was invalidated. This may occur in your own
component or in another component that uses the same context node via
external context mapping.
If the component uses an ALV component and transfers the data by means
of external context mapping to the ALV component, lower-level n
odes are invalidated during the filter or sort operation. You can
eliminate this problem by implementing an event handler for the ALV
standard functions.
The node or a higher-level node is a singleton and access does not occur
by means of lead selection. This may be the case with the UI
elements Table, Tree, Multipane, DropdownByIndex or similar, for
example.
When changes are made to the node info, the related context nodes are
usually also invalidated. As a result, all lower-level nodes are
invalidated of course.
Reasons why lead selection is not set
The "Initialization of lead selection" property was accidentally deleted
in the context editor. This property should be activated in n
early all cases.
The node is transferred to the ALV by means of external context mapping
and the user has used the filter functions or the lead selecti
on row is not displayed because of the ALV configuration settings. The
lead selection is then deleted by the ALV.
The user has deleted the lead selection in the table, for example. This
occurs when you select the selected line again by pressing the
CTRL key.
Reasons why a context element cannot be found
The business logic has not found any data, and the context node is
therefore empty.
A search is performed for the element using the lead selection. However,
the lead selection is not set.
The node was invalidated.
The node is declared with cardinality 0..1 or 0..n, and it was not
filled.
The method that should fill the context is only called after the read
access. This may happen, for example, if the context is filled i
n an inbound plug, but should already be used in a WDDOINIT of a view or
subcomponent.
The application assumes a particular number of context elements that you
want to display in a table UI element, for example. However,
this number was changed by personalization. NOTE: You cannot check the
number of table rows actually displayed.
Other error sources when you use the context:
The application saves the reference to a context node or context
element. However, this may be invalid at a later point. It is prefera
ble to save the root node and path for the context node.
Solution instructions
Check if one of the above described points applies to your application.
Before you work with context nodes or context elements that you
reference, you must check whether the context node or context element
is still valid. Use the method IS_ALIVE( ). Delete all references to
context nodes and elements in the method WDDOEXIT of the controll
er.
If the application terminates with a short dump, start transaction ST22,
search for the short dump, and follow the instructions it con
tains. Even the error description often provides tips that are useful
for troubleshooting. The context path is extremely important. Th
is is displayed for a large number of context errors.
Go to the source code and/or to the call list. It may be useful to view
the code displayed there, even if it is not your own. Sometime
s, comments may result in error correction.
Set an external BREAKPOINT at the error location or just before it.
Reproduce the error and analyze the current variables in the debug
ger.
A "Web Dynpro" special tool is available for the new debugger. Select
this and take a close look at the current context in the differe
nt controllers. The context of a node may possibly appear empty after
you have filled it using BIND_TABLE. An optimization was then us
ed for the node and this creates the elements as required only. In this
case, display the context node as an object and check the TABL
E_REF attribute. This should point to the internal table that was
transferred with BIND_TABLE.
Use the watchdog program if you do not know why a valid context node has
suddenly become invalid. Set the watchdog program at a time w
here the node is valid. You can also use the "{" addressing function to
set watchdog programs on objects and their attributes.
If the watchdog program does not stop, and all measures implemented to
date have not taken effect, change the code to set the context
node, a particular element or a particular attribute to "final". The
short dump is then generated at the precise moment when the conte
xt area is changed.
Description of problem
WD ABAP, Context, lead selection, CX_WD_CONTEXT