cancel
Showing results for 
Search instead for 
Did you mean: 

DropDown by index not clearing previous values

Former Member
0 Kudos

Dropdown by index issue.

I am having a problem with my dropdown not clearing previous entries.

I have a webdynpro that has two views, main and appraisal. I can enter the appraisal view from the main. The appraisal view contains a drop down. At this point, I the dropdown appears to work correctly. However, if I then enter a second appraisal, the drop down displays the value from the previous entry. I tried clearing out the drop down in wddomodifyview, but that just cleared out the actual line of the previous selection in the drop down, so I removed that code.

Here is what I have done so far.

Under Context in the appraisal view, I have created a node named DD1_1 which contains the attributes rating and rtext.

I have created a Supply Function attached to it called DD_MAPPING1_1, which contains the following code:


method DD_MAPPING1_1 .

* create local data variable to access context information
  Data: context_node type ref to if_wd_context_node.

* create table based on context structure
  Data: it_rating type STANDARD TABLE OF if_appraisal=>element_DD1_1,
        wa_rating like line of it_rating.

  clear wa_rating.
  wa_rating-rating = ' '. wa_rating-rtext = ' '.
  append wa_rating to it_rating.
  wa_rating-rating = '1'. wa_rating-rtext = 'Below Expectations'.
  append wa_rating to it_rating.
  wa_rating-rating = '2'. wa_rating-rtext = 'Met Expectations (low)'.
  append wa_rating to it_rating.
  wa_rating-rating = '3'. wa_rating-rtext = 'Met Expectations (medium)'.
  append wa_rating to it_rating.
  wa_rating-rating = '4'. wa_rating-rtext = 'Met Expectations (high)'.
  append wa_rating to it_rating.
  wa_rating-rating = '5'. wa_rating-rtext = 'Exceeded Expectations'.
  append wa_rating to it_rating.

  context_node = wd_context->get_child_node( name = 'DD1_1').
  context_node->BIND_TABLE( it_rating ).

endmethod.

I feel I am missing something, but seeing this is my first time attempting a dropdown, I am not certain what.

Any assistance would be appreciated.

Accepted Solutions (1)

Accepted Solutions (1)

abhimanyu_lagishetti7
Active Contributor
0 Kudos

In dropdownbyindex, if you choose a value that element is set as selected.

next time when you come to appraisal view, the element is already selected is shown in the dropdown.

you have to clear the selection before entering appraisal view.

use method SET_LEAD_SELECTION of the IF_WD_CONTEXT_NODE to set it to blank

code it in inbound plug handler of the appraisal view.

Edited by: Abhimanyu Lagishetti on May 19, 2010 4:29 PM

Former Member
0 Kudos

I have tried this code in the inbound plug handler:

  DATA lo_nd_dd1_1 TYPE REF TO if_wd_context_node.
  DATA lo_el_dd1_1 TYPE REF TO if_wd_context_element.

* navigate from <CONTEXT> to <DD1_1> via lead selection
  lo_nd_dd1_1 = wd_context->get_child_node( name = wd_this->wdctx_dd1_1 ).

* get element via lead selection
  lo_el_dd1_1 = lo_nd_dd1_1->get_element( ).

  clear lo_el_dd1_1.

  lo_nd_dd1_1->set_lead_selection(
    element = lo_el_dd1_1

and the program is bombing out with the message

Invalid index 0 when setting lead selection; context node: APPRAISAL.1.DD1_1

Should I be using set_lead_selection_index?

Thank you for all your help.

Edited by: Ed Left on May 19, 2010 5:25 PM

Former Member
0 Kudos

I don't think I understand the use of set_lead_selection. Any clue what I have done wrong in the previous example?

Former Member
0 Kudos

Worked thru it and resolved issue.

Thanks.

dhinesh_thirugnanam
Active Participant
0 Kudos

Hi,

Could you please tell me the steps how you have cleared the dropdown list.

Answers (0)