I'm trying to use this method over a node with Cardinality 1..1, Selection 0..1 and Init. Lead selection enabled, in order to retrieve some previously changed attribute properties
(changed with SET_ATTRIBUTE_PROPS_FOR_ELEM).
The idea is, I modify several attribute properties based on configuration tables, using SET_ATTRIBUTE_PROPS_FOR_ELEM, each time some conditions occur.
Those attribute properties in turn are bound to UI properties in the layout. So this way I achieve configurable field properties as Required, Visible, etc.
Now, at a later time, I need to know which fields are visible to use their contents, so I need to retrieve the properties.
I'm having problems using this method because I get the defaults when I try to get the Lead selection element properties, and I think maybe it's a SAP error (the actual class which implements this method this way is CL_WDR_CONTEXT_NODE_VAL):
method IF_WD_CONTEXT_NODE~GET_ATTRIBUTE_PROPERTIES. field-symbols: <prop> type wdr_ctxt_property. read table me->attribute_properties WITH TABLE KEY element_index = index attribute_name = attribute_name assigning <prop>. if sy-subrc <> 0. assign cl_wdr_context_element=>default_properties to <prop>. endif. move-CORRESPONDING <prop> to properties. endmethod.
Instead of element_index = index coded on the READ statement, shouldn't the lead selection's actual index be searched for first, in case -1 (USE_LEAD_SELECTION) is received, and afterwards the real index be used?
Using debug I see the table me->attribute_properties has the correct attribute properties values, but they cant be retrieved since the lead selection's actual index is 0 and the table is accessed with -1.
So the defaults are returned instead.
Method GET_ATTRIBUTE_PROPS_FOR_ELEM seems to work the same way also.
As a workaround I'm forcing the INDEX = 0 on the method call, but this of course is a temporary solution.
I've searched a bit for notes on the SMP with no luck. Has anyone else had this error and got a fix? I'm on SP12.
Many thanks
Edited by: Alejandro Bindi on Jan 15, 2009 11:58 AM