Skip to Content


During my experience as a Web Dynpro for ABAP developer, I often had the doubt if it was better to use the UI element DropDownByKey or its brother DropDownByIndex.    

In these last days, I realized that I always prefer and use the DropDownByKey, it doesn’t matter if the list is inside a table, an ALV table or a simple element in a view. Clearly the index approach is also working well but I feel it as a more complex task that requires spending more time, and I’m wondering to know about your experience.

As a reference, I’m sharing below the step-by-step guide to build a DDL even without necessarily entering the fixed values ​​associated to a domain of the field.


First of all, I created a WDA with its Assistance Class used to encapsulate the reading of a couple of well-known tables like MARA and T134T (Material Type Descriptions).  

The idea is to display all MARA records changing the field MTART in a DropDownByKey.         

DDL By Key picture1.png

I added the component usage SALV_WD_TABLE to create an ALV table and in assistance class I have implemented two methods:   

DDL By Key picture2.png

Method FILL_TABLE    

(output parameter –> ET_MARA  Type  MARA_TAB):

METHOD fill_table.
SELECT * FROM mara INTO TABLE et_mara.


(output parameter –> LT_VALUE_SET  Type WDY_KEY_VALUE_TABLE):

METHOD get_type_material.
DATA: lt_t134t            TYPE TABLE OF t134t.
*  field-symbols: <fs_t134t> type t134.
FIELD-SYMBOLS: <fs_t134>  TYPE t134t.
DATA ls_value             TYPE wdy_key_value.
SELECT * FROM t134t INTO TABLE lt_t134t WHERE spras = 'E'.
SORT lt_t134t BY mtart.
LOOP AT lt_t134t ASSIGNING <fs_t134>.
MOVE <fs_t134>-mtart TO ls_value-key.
MOVE <fs_t134>-mtbez TO ls_value-value.
APPEND ls_value TO lt_value_set.

I have created a context in Component controller called ALV_TABLE with structure of MARA table.

Now in the HANDLEDEFAULT method of my WINDOWS I’m calling a component controller method where we will call the two assistance class methods:

DATA lo_nd_alv_table TYPE REF TO if_wd_context_node.
DATA lt_alv_table TYPE wd_this->elements_alv_table.
*   navigate from <CONTEXT> to <ALV_TABLE> via lead selection
lo_nd_alv_table = wd_context->get_child_node( name = wd_this->wdctx_alv_table ).
lo_nd_alv_table->get_static_attributes_table( IMPORTING table = lt_alv_table ).
lt_alv_table = wd_assist->fill_table( ).
lo_nd_alv_table->bind_table( new_items = lt_alv_table set_initial_elements = abap_true ).
DATA lr_node_info TYPE REF TO if_wd_context_node_info.
DATA lt_value_set TYPE wdy_key_value_table.
lr_node_info = lo_nd_alv_table->get_node_info( ).
* set sales district ddl
lt_value_set = wd_assist->get_type_material( ).
*--- set attribute info
lr_node_info->set_attribute_value_set( name = `MTART` value_set = lt_value_set ).

How you can see, we are binding the context ALV_TABLE calling method wd_assist->fill_table( ).The last three rows are used to set values in my drop down by key.  

And this is the result:   

DDL By Key picture3.png

To report this post you need to login first.


You must be Logged on to comment or reply to a post.

  1. Chris Paine
    I would also note that drop down by index does not allow you to highlight the field in any error that you encounter – as no possibility to flag the field in the raised message.

    Only use case I can see is where different drop-downs per line are required. (Can also be covered by cell variants and dropdown by keys if you have only a few variations – but usually better to use dropdown by index.)

    1. Chris Paine
      I should have noted that this is not just an ALV issue but applies to tables in general in both WDA and WDJ.
      1. Fabio Di Micco Post author
        Yes Chris, this works not only for the ALV table but also for all other tables. But I always prefer to use ALV tables because they are faster to develop. The only case, that I do not use it, is when I have to do the table popin because it is not supported in ALV tables 😉
  2. Tom Van Doorslaer
    A dropdown by key is to change the value of a single field in a specific record.

    A dropdown by index is to change the selected record in a table.

    however, you can “abuse” the DDI by adding a subnode containing the desired values and binding the DDI index to this subnode. as an added advantage, each record can now have a different valueset, whereas the DDK has the same valueset for each record in the node.


Leave a Reply