cancel
Showing results for 
Search instead for 
Did you mean: 

Fill Dropdown (by key)-input with values from search help

Former Member
0 Kudos

Hello,

in my context node i'm using an attribute with SPRAS-Domain (Language key). "Input help" is detected automativally and identified correctly as "search help". Binding a dropdown-UI-element to this attribute this element shows me the current value from the context but has no other options to choose from (I'd like to have all other values from Search help in this dropdown).

Binding a normal text input field to this context attribute the current value from context is shown and values from serach help are shown when pressing F4.

Is it not possible to use the values from search help as values for dropdown (i understood the documentation in that way, that the values of the search help should be used automatically) or have I missed something?

Best regards,

Michael

Accepted Solutions (1)

Accepted Solutions (1)

former_member450736
Active Participant
0 Kudos

Hi,

Filling drop down list with data element is possible, following are prerequisities for the same.

1. Drop down list should be based on key binding, it means only works for 'dropdownbykey' and

2. data element with domain should have fixed values, which will be displayed as drop down values.

Former Member
0 Kudos

Hi,

other dropdown lists with binding to domains with fix values work as exspected showing those values.

But for this additional dropdown list the values from search help should be automatically determined and assigned.

Isn't there any possibility to do this? So there is no advantage at all defining a search help for an DDIC-Element that only occurs in dropdown lists and not in text input fields?

Best regards, Michael

saravanan_narayanan
Active Contributor
0 Kudos

Hello Michael,

I think the idea of SVS/Drop down is to display only minimal number of entries. Because if we display huge number of entries in the drop down, it will be difficult for the user to look for the required entry.

Thats the reason DropdownByKey uses only the data from Fixed values of the Domain and not the Search Help data. We usually go for search helps only if the entries are huge and if we want to provide the user an option to search.

hope I'm of bit help here.

Thanks and Regards,

Saravanan

Former Member
0 Kudos

Hello Saravanan,

perhaps my approach is wrong at all.

I don't want to display large amount of data in a dropdown list (will be aprox. 15 entries), but customizable values.

Therefore my idea was it is much easier to maintain a table and add or rename entries there than to modify the domain each time, the values are changing.

So it would be helpful to retrieve the values from this table and not fix values.

Or is there another best practise to solve this requirement I've overseen?

best regards,

Michael

saravanan_narayanan
Active Contributor
0 Kudos

Hello Michael,

If your requirement is such that the values will change, then DDIC table is the best approach. But to get the table values in the DropDownByKey, you need to write some coding. Have a look at the following documentation which explains about how to populate the value set for DropDownByKey

http://help.sap.com/saphelp_nw04s/helpdata/en/27/c3c241fdc6c617e10000000a155106/content.htm

BR, Saravanan

Former Member
0 Kudos

Hi,

here's a quick method that outlines what you need. You can call it, say, from every WDDOMODIFYVIEW - or as often as the value set for the dropdown changes (for example, based on the value of another view element...):

method populate_search_helps.

data lo_node_info type ref to if_wd_context_node_info.

data lt_key_table type wdy_key_value_table.

data lwa_key_value type wdy_key_value.

  • Context node for the dropdown box:

data lo_nd_dropdown type ref to if_wd_context_node.

  • ZVALUE is a structure containing your key and value fields (line type of lt_lookup_values):

field-symbols: <fs_value> type zvalue.

refresh lt_key_table.

  • We assume the values you need are stored in an attribute of your assistance class... namely

  • the table lt_lookup_values. These contents will have to be refreshed whenever neeeded.

loop at wd_assist->lt_lookup_values assigning <fs_value>.

move <fs_value>-key to lwa_key_value-key.

move <fs_value>-text to lwa_key_value-value.

append lwa_key_value to lt_key_table.

endloop.

  • Set the retrieved values as the value set of the dropdown box:

lo_nd_dropdown = wd_context->path_get_node( path = `MY_DROPDOWN` ).

lo_node_info = lo_nd_dropdown->get_node_info( ).

lo_node_info->set_attribute_value_set(

exporting name = 'DROPDOWN_VALUES'

value_set = lt_key_table ).

endmethod.

Former Member
0 Kudos

Hi Saravanan,

what a pity that this is not possible.

I've solved it as described in the documentation you have linked to and find out that it only works if the value in the valuelist is clike. My initial used integer as value doesn't work...

Answers (1)

Answers (1)

phanir_mullapudi
Active Participant
0 Kudos

Hi,

You can still achieve your functionality by using custom coding in WDDOMODIFY to fill the dropdown values, by using some FM to read the Search help values or read directly from corresponding table & then fill them into Context attribute for holding dropdown values using Context node info.

Hope this gives you some idea.

Regards,

Phani