Skip to Content
avatar image
Former Member

Cannot load DropDownByKey using Supply Function

Hi

I am wondering why I cannot load a DDBK Popup with values using a supply function. (But I can do it using WDDOINIT or WDDMODIFYVIEW). If I use a SF then the popup is displayed empty. Can anyone tell me what I am missing because I think it should be possible.

The situation:- I have a context node called DDBK_NODE (1:1) with 1 attribute called AKEY of type string. I create a table of key/value pairs. This table become the list of allowed values for a particular context attribute (eg AKEY). This is defined in the NODE_INFO (not NODE). The DDBK UI element binds the selectedKey property to the AKEY context attribute. see code below.

(I also learn't that if I use an SF then I must manually create a dummy context element in the node in order to avoid a cardinality error. This (I believe) is because my value list, since it is in NODE_INFO, does not introduce any context elements)

data lr_current_node type ref to if_wd_context_node.

data lr_element TYPE REF TO if_wd_context_element.

  • NOTE these 3 lines are only needed if using Supply Function in order to prevent cardinality conflict

  • create dummy context element

lr_current_node = wd_context->get_child_node( 'DDBK_NODE' ).

lr_element = lr_current_node->create_element( ).

lr_current_node->bind_element( new_item = lr_element set_initial_elements = abap_true ).

**

data Stru_Ddbk_Node_attr_kv_table type WDY_KEY_VALUE_TABLE.

data Stru_Ddbk_Node_attr_kv type WDY_KEY_VALUE.

Stru_Ddbk_Node_attr_kv-key = '1'.

Stru_Ddbk_Node_attr_kv-value = 'text1'.

append Stru_Ddbk_Node_attr_kv to Stru_Ddbk_Node_attr_kv_table.

Stru_Ddbk_Node_attr_kv-key = '2'.

Stru_Ddbk_Node_attr_kv-value = 'text2'.

append Stru_Ddbk_Node_attr_kv to Stru_Ddbk_Node_attr_kv_table.

data lr_node_info type ref to if_wd_context_node_info.

lr_node_info = wd_context->get_node_info( ).

lr_node_info = lr_node_info->get_child_node( 'DDBK_NODE' ).

lr_node_info->set_attribute_value_set( name = 'AKEY' value_set = Stru_Ddbk_Node_attr_kv_table ).

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Sep 21, 2010 at 09:22 AM

    After messing around I have now succeeded in loading the DDBK valueset from the context node Supply Function. Not sure what I did to fix it.

    One thing I noticed is that one must create a dummy action on the "onSelect" property of the DDBK UI element in order to get a server round trip when the drop down is changed by the user. (This does not seem to be documented in the Web Dynpro for Abap book)

    Edited by: Peter Cutting on Sep 21, 2010 11:22 AM

    Add comment
    10|10000 characters needed characters exceeded

    • >One thing I noticed is that one must create a dummy action on the "onSelect"

      That isn't specific to the DDLBByKey. If you don't create an Action/Event Handler for an event, it will not trigger to the server. If there is no event handler, then why waste the processing time to return to the server. This does sometimes mean that you need to use a "dummy" or empty event handler if you want to trigger something - like the WDDOMODIFYVIEW method.