cancel
Showing results for 
Search instead for 
Did you mean: 

User choosen entry in the drop-down list o

former_member202077
Participant
0 Kudos

Hello,

On the initial / main view am providing a input field with drop-down ability, i wrote the below code in INITIALIZATION event in order to fill the drop-down list, fine


  l_string = 'ZZ_PLANT'.
  w_l_element-value =  'NJ'.
  w_l_element-text  =  'PLANT_NEW_JERSEY'.

  APPEND w_l_element TO it_l_elements.
  CLEAR w_l_element.

  w_l_element-value =  'NY'.
  w_l_element-text  =  'PLANT_NEW_YORK'.

  APPEND w_l_element TO it_l_elements.
  CLEAR w_l_element.

  CALL METHOD node_info->set_attribute_value_set
    EXPORTING
      name      = l_string
      value_set = it_l_elements. 

Working fine, when user clicks the drp-down (like F4) i am getting a table format popup with 2 colums, one is for VALUE (example data 'NJ') and the 2nd is for TEXT (example data is 'PLANT_NEW_JERSEY'), fine. As i hv given only 2 entries (NJ and NY) here, hence am getting 2 records in the popup table, fine.

Now, say the user has selected the 2nd record (NY), now, i need to CAPTURE that index (in this case it should be '2' as user has selected 2nd record) number/value in my prog. for some reason.

Pls let me know How to get the selected INDEX number/value in the drop-down list?

Tha nk you

Accepted Solutions (0)

Answers (2)

Answers (2)

sahai
Contributor
0 Kudos

hi,

you will have to code it that way.....

i.e you will have to read the user selected and value and then via coding

if it is 'NJ' consider it 1 else consider it 2.

else wise you will have to write this

w_l_element-value = 1 instead of w_l_element-value = 'NJ'

Regards,

Sahai.S

former_member199125
Active Contributor
0 Kudos

hi..

I dont think we have a method to retrieve the index of list.

Check in cl_wd_dropdown_by_key class, you wont find any method to retrieve the index.

Tell me your requirement so that we can look for alternative.

Working fine, when user clicks the drp-down (like F4) i am getting a table format popup with 2 colums, one is for VALUE (example data 'NJ') and the 2nd is for TEXT (example data is 'PLANT_NEW_JERSEY'), fine.

it seems that you binded the attribute to input field not dropdown by key. you will get table format for input field only, for dropdown by key simply you will get one list.

Regards

Srinivas