cancel
Showing results for 
Search instead for 
Did you mean: 

drop down list in web-dynpro abap

Former Member
0 Kudos

Hi friend,

i want to drop down list in WEB-DYNPRO abap kindly give me one example .

regards

vikash

Accepted Solutions (1)

Accepted Solutions (1)

uday_gubbala2
Active Contributor
0 Kudos

Hi Vikash,

You can actually use 2 different kind of drop down by keys within WDA. One is by using DropDownByKey & the other is by using DropDownByIndex. The values displayed by the drop down can be stored in the context, or they can by related to the type to which the UI element is referring. The first approach of binding the drop down to an context node of cardinality 0..n or 1..n is called Index Binding. Before the view (containing the

value selector) can be rendered, the collection has to be populated. This means all values to be displayed in the value selector are to be stored in the context as attribute values of the collection elements.

The second possibility to define a value set displayed by the value selector is to relate the value set to the type to which the UI element is referring. In this case, the UI element has to be bound to a context attribute, which is typed as follows:

1) The attribute is an ABAP Dictionary type, which is based on a domain with fixed values. The short texts related to the fixed values are displayed by the value selector.

2) The attribute is a Web Dynpro runtime type with fixed values. These fixed values are displayed by the value selector.

3) The attribute's type is arbitrary. The value set is assigned dynamically by changing the attribute's metadata at runtime.

If you want to find an example of how you can implement the drop downs in WDA then you can try go through section [3.3.1 from Ulli Hoffman's Web Dynpro for ABAP|http://www.sap-press.de/download/dateien/1079/sappress_web_dynpro_for_abap.pdf].

Regards,

Uday

If you want to implement the drop downs within the cells of a table then go through this thread ([Thread|;)where I have explained the same.

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi

Maybe this standard SAP component helps you..DEMO_VARIABLE_DROPDOWN

Chitrali

Former Member
0 Kudos

Hi Vikash,

Also check these standard programs for your better understanding.

WDR_TEST_ui_elements

wdr_test_tablein this go to the view TABLE_CELL_EDITORS to know how to place drop downs in table.

uday_gubbala2
Active Contributor
0 Kudos

Suppose you have created a DropDownByIndex on your screen & bound its "Texts" attribute to a context attribute by name DROPDOWN then you can put the below coding into your WDDOINIT method to fill the values to be displayed:

METHOD wddoinit .
  DATA: lv_node TYPE REF TO if_wd_context_node,
        lt_texts TYPE if_main=>elements_dropdown,
        wa_texts TYPE if_main=>element_dropdown.

  lv_node = wd_context->get_child_node( name = 'DROPDOWN' ).

  wa_texts-application = ' '.
  APPEND wa_texts TO lt_texts.

  wa_texts-application = 'MS Word'.
  APPEND wa_texts TO lt_texts.

  wa_texts-application = 'MS Excel'.
  APPEND wa_texts TO lt_texts.

  wa_texts-application = 'Notepad'.
  APPEND wa_texts TO lt_texts.

  lv_node->bind_table( new_items = lt_texts ).
ENDMETHOD.

Suppose you are using a DropDownByKey & bound the "Selected Key" property to the context attribute by name TEMP then you can proceed as shown below to fill the dropdown with values:

data: lr_node_info type ref to if_wd_context_node_info,
        wa_value_set type wdr_context_attr_value,
        lt_value_set type table of wdr_context_attr_value.

  lr_node = wd_context->get_child_node( name = 'NODE' ).
  lr_node_info = lr_node->get_node_info( ).
  wa_value_set-value = '1'.
  wa_value_set-text  = 'One'.
  insert wa_value_set into table lt_value_set.

  wa_value_set-value = '2'.
  wa_value_set-text  = 'Two'.
  insert wa_value_set into table lt_value_set.

  wa_value_set-value = '3'.
  wa_value_set-text  = 'Three'.
  insert wa_value_set into table lt_value_set.

  lr_node_info->set_attribute_value_set( name      = 'TEMP'
                                         value_set = lt_value_set ).

Regards,

Uday

Go through the Web Dynpro component DEMO_UIEL_STD_SELECTION for a working example of DropDownByKey & DropDownByIndex

0 Kudos

Hi Uday,

Thanks for helping us,

And you missed one line of code,

Just for the viewers,

Here is the right code.

Suppose you are using a DropDownByKey & bound the "Selected Key" property to the context attribute by name TEMP then you can proceed as shown below to fill the dropdown with values:


data: lr_node TYPE REF TO if_wd_context_node,
      lr_node_info type ref to if_wd_context_node_info,
      wa_value_set type wdr_context_attr_value,
      lt_value_set type table of wdr_context_attr_value.

  lr_node = wd_context->get_child_node( name = 'NODE' ).
  lr_node_info = lr_node->get_node_info( ).
  wa_value_set-value = '1'.
  wa_value_set-text  = 'One'.
  insert wa_value_set into table lt_value_set.

  wa_value_set-value = '2'.
  wa_value_set-text  = 'Two'.
  insert wa_value_set into table lt_value_set.

  wa_value_set-value = '3'.
  wa_value_set-text  = 'Three'.
  insert wa_value_set into table lt_value_set.

  lr_node_info->set_attribute_value_set( name      = 'TEMP'
                                         value_set = lt_value_set ).

Regards,

Arul.