Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

DropdownByKey in a table

hello,

I want to know if is it possible to put a dropdownbykey in a table column. I want to set the possible value of the list of dropdownbykey; I can do it in a "stand alone" dropdownbykey, but if I try to insert the dropdownbykey as cell editor, nothing works. I get a runtime error I can't understand:

"You tried to access the singleton node SHOW_VIEW.1.TABLE_NODE.1.PRIO_DROP in a way other than the lead selection. "

where "TABLE_NODE" is the node where I bind the internal table and "PRIO_DROP" is the node nested in TABLE_NODE on which I created the dropdownbykey list.

I am new in web dynpro and maybe I learn some concepts in a wrong way.

with this code I fill the list of dropdownbykey:

" dropdown table elements
  DATA t_value_ddbk TYPE wdy_key_value_table.
  DATA wa_value_ddbk TYPE wdy_key_value.

  " context node
  DATA ddbk_info TYPE REF TO if_wd_context_node_info.
  DATA table_info TYPE REF TO if_wd_context_node_info.
  DATA node_info TYPE REF TO if_wd_context_node_info.
  " get reference to nested node
  node_info = wd_context->get_node_info( ).
  table_info = node_info->get_child_node( name = wd_this->wdctx_table_node ).
  ddbk_info = table_info->get_child_node( name = wd_this->wdctx_prio_drop ).

  " fill table with possible values
  wa_value_ddbk-key = '1'.
  wa_value_ddbk-value = 'Alta'.
  INSERT wa_value_ddbk INTO TABLE t_value_ddbk.
  wa_value_ddbk-key = '2'.
  wa_value_ddbk-value = 'Normale'.
  INSERT wa_value_ddbk INTO TABLE t_value_ddbk.
  wa_value_ddbk-key = '3'.
  wa_value_ddbk-value = 'Bassa'.
  INSERT wa_value_ddbk INTO TABLE t_value_ddbk.
  
  " select node ddbk
  ddbk_info->set_attribute_value_set(
                name = 'CHOOSEN'
                value_set = t_value_ddbk ).

can anybody help me or tell me if I misunderstood something?

thanks

Gabriele

Former Member
replied

I'm not sure the way you're getting the subnode info is allowed, I think that is the problem with your coding, unfortunately I have no system now to check it.

Try replacing this code section of yours:

  " context node
  DATA ddbk_info TYPE REF TO if_wd_context_node_info.
  DATA table_info TYPE REF TO if_wd_context_node_info.
  DATA node_info TYPE REF TO if_wd_context_node_info.
  " get reference to nested node
  node_info = wd_context->get_node_info( ).
  table_info = node_info->get_child_node( name = wd_this->wdctx_table_node ).
  ddbk_info = table_info->get_child_node( name = wd_this->wdctx_prio_drop ).

With this:

  " context node
  DATA table TYPE REF TO if_wd_context_node.
  DATA ddbk TYPE REF TO if_wd_context_node.
  DATA ddbk_info TYPE REF TO if_wd_context_node_info.
  " get reference to nested node
  table = wd_context->get_child_node( name = wd_this->wdctx_table_node ).
  ddbk = table->get_child_node( name = wd_this->wdctx_prio_drop ).
  ddbk_info = ddbk->get_node_info( ).

Let me know if this works.

Regards

Edited by: Alejandro Bindi on Oct 17, 2008 1:37 AM

I'm sorry I didn't notice this before. You DON'T need a subnode as prio_drop to create a DropDownByKey inside a table (you would need it for DropDownByIndex).

Just delete the node PRIO_DROP and put the CHOOSE attribute directly underneath the TABLE_NODE node and bind the DDK to it. Set the values over that node also.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question