cancel
Showing results for 
Search instead for 
Did you mean: 

read user selected value in drop down by key.

Former Member
0 Kudos

Hi

I have added drop down by key in table as one of the column. I am getting the entries in the 'drop down by key' but unable to catch the user selected entry. I have to write a method in the 'onselect' event of that UI element.

Please help me on how we can catch the user selected value in the drop down by key?

Thanks in advance...

Regards

Rama

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi,

Just the read the attribute binded to dropdown by key in the Onselect event . It will give you key of value selected.

Use Code Wizard to read the attribute (control _ F7 ).

Answers (3)

Answers (3)

Former Member
0 Kudos

hi Rama ,

proceed like this :

1 bind ur context node say cn_node to the table UI .

2 all ur columns in the table are binded to the context attributes which are under this context node

3 suppose ur dropdown is binded to a context attribute ca_attr , so this attribute shud be under the context node

cn_node

4 u can get the line selected by the user in a structure using get_stattic_attributes

use this code in OnselectEvent



  DATA : lo_nd_cn_input  TYPE REF TO if_wd_context_node ,
         lo_el_cn_input  TYPE REF TO if_wd_context_element ,
         ls_cn_input     TYPE wd_this->element_cn_input ,
         ls_cn_input1    TYPE wd_this->element_cn_input.

*    navigate from <CONTEXT> to <CN_INPUT> via lead selection
  lo_nd_cn_input = wd_context->get_child_node(
  name = wd_this->wdctx_cn_input ).

*    get element via lead selection
  lo_el_cn_input = lo_nd_cn_input->get_element(  ).

*     get all declared attributes
  lo_el_cn_input->get_static_attributes(
    IMPORTING
      static_attributes = ls_cn_input ).

5 now u have got the values in the structure , so u can get the vallue selected for ur dropdown , using

the below code :


DATA : lv_dropdown type string .
lv_dropdown =  ls_cn_input-ca_attr

now the variable lv_dropdown holds value . u cn use it in the method of ur view

I hope it helps

rgds,

amit

Former Member
0 Kudos

Hi,

In order to catch the user slection run over the table elements in a loop and for each

element get the value of the dropdown by it's context attribute.

hope it's help:)

Regards,

Shimon

Former Member
0 Kudos

hi,

Use this code if you want to capture the row in which drop down has been selected without lead selection of row.

data: lr_element type ref to if_wd_context_element.

DATA ls_cn_popin TYPE wd_this->element_cn_popin.

lr_element = wdevent->get_context_element( 'CONTEXT_ELEMENT' ).

  • get all declared attributes

lr_element->get_static_attributes(

IMPORTING

static_attributes = ls_cn_popin ).

Now from ls_cn_popin you can read the column which ever you want.

data lv type string.

lv = ls_cn_popin-dropdownColumn.

Lv would have the value .

Former Member
0 Kudos

HI Saurav

I think your second solution will give the table row not the selected value from drop down.

I have tried to read the attrbute value using code wizard.

But it is writing empty value. Please suggest any alternate method.

Thanks

Rama

Former Member
0 Kudos

Hi,

Is your dropdownbykey selected key is bound to the context attribute properly..

One more thing, does this node(ie top which the key is bound) has any empty values in drop down..

Are you using any standard DE or table to get the entries for this dropdown or are you filling them through any other means...

If you are using any standard one please provide the name of it.. Check in debugging for these values.

Regards,

Lekha.