cancel
Showing results for 
Search instead for 
Did you mean: 

search help change in dropdownByKey

Former Member
0 Kudos

Hi,

I have a dropdownByKey on WD abap page selectedKey is set to SLART (HR infotype 22, education) field. My assignment is to change the amount of available option in dropdown list.

What I have done so far is ...

create custom search help which works as I want it to

set the SLART fields attribute Input Help Mode to Dictionary Search Help, set the Dictionary Search Help attribute to my new Z search help

modified context binding in views using changed context mode

(I was able to accomplish the result I need by loading data from DB table on init of the view, but that does not seems optimal solution to me)

My problem currently is that the drop down list still contains all the values from standard search help, so it looks like it "ignored" the search help change.

Did I forget something or what is the correct way of changing that attribute? Or what is the correct way to change the select options of dropdownByKey?

Thanks for every help in advance

Martin

Accepted Solutions (0)

Answers (1)

Answers (1)

amy_king
Active Contributor
0 Kudos

Hi Martin,

You can manually fill a DropDownByKey element with possible values by calling method IF_WD_CONTEXT_NODE_INFO->SET_ATTRIBUTE_VALUE_SET( ). The following code could be written in the WDDOINIT method of the COMPONENTCONTROLLER so that it executes only once upon initialization of the COMPONENTCONTROLLER.

 
  DATA lo_nd_node TYPE REF TO if_wd_context_node.
  DATA lo_node_info TYPE REF TO if_wd_context_node_info.
  DATA lt_value_set TYPE wdr_context_attr_value_list.

  lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_node ).
  lo_node_info = lo_nd_node->get_node_info( ).

* Read key/value pairs from the database, for example...
  SELECT tvsb~vsbed  AS value
         tvsbt~vtext AS text
         FROM tvsb
         JOIN tvsbt ON tvsbt~vsbed = tvsb~vsbed
         INTO TABLE lt_value_set
         WHERE tvsbt~spras = sy-langu
         ORDER BY text.

* Set the key/value pairs in the DropDownByKey element
  lo_node_info->set_attribute_value_set(
    EXPORTING
      name      = 'ATTRIBUTE_NAME'
      value_set = lt_value_set
  ).

Cheers,

Amy

Former Member
0 Kudos

Hi Amy,

thanks for the idea, but it does not seem to work, even after I deactivated the search help in context it still offers the standard values.

Martin

amy_king
Active Contributor
0 Kudos

Are you able to provide screen captures of your context, code snippets, etc? What enhancement pack are you on? I've used this approach before so maybe there's a detail missing somewhere. Below is the context attribute that goes with the above code snippet and I've left Input Help Mode as automatic without it causing trouble.