cancel
Showing results for 
Search instead for 
Did you mean: 

IF_WD_CONTEXT_NODE~GET_ATTRIBUTE_PROPERTIES error? (Lead selection access)

alejandro_bindi
Active Contributor
0 Kudos

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

Accepted Solutions (0)

Answers (1)

Answers (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

I can confirm that in my 7.02 system the coding is the same for this method. It does seem like the method would be suggesting that the default -1 value should lookup the lead selection and use that index. Of course you could do the same from the surrounding code and pass in the correct index. You might want to enter a support ticket to see if the developers want to change this method to match the interface description, otherwise it sounds like a work around shouldn't be too difficult.

alejandro_bindi
Active Contributor
0 Kudos

Well I was coming back to say that I've tried what you suggest, to get the lead selection index myself and then pass it: using method GET_LEAD_SELECTION_INDEX( ) (which returns attribute ME->LEAD_SELECTION_INDEX) I get a value of 1, not 0.

So even if the logic was added to GET_ATTRIBUTE_PROPERTIES in order to use the lead selection index when USE_LEAD_SELECTION is received, it still wouldn't work. A correction seems to be needed also in the coding which populates the table ME->ATTRIBUTE_PROPERTIES. Besides most probably other properties related methods such as SET_ATTRIBUTE_PROPS_FOR_NODE are also affected by this.

It seems like a support ticket is the only option...

Thank you Thomas.

Regards