cancel
Showing results for 
Search instead for 
Did you mean: 

DropdownListBox value in TableView not returned in 'OnInpuProcessing' event

Former Member
0 Kudos

Hi All,

I have a tableView where the 4th column is set up as a dropdownListBox. The values are available for selection in the dropdown and when selected the value is returned to the screen field as required. This part all seems to be working fine.

The problem is that I am not able to retrieve the value from this field when control passes back to the 'OnInputProcessing' event.

The Layout code is as follows:

 
            <htmlb:tableView id              = "tv_idint" 
                             table           = "<%= it_data %>" 
                             visibleRowCount = "10" 
                             selectionMode   = "LINEEDIT" 
                             onRowSelection  = "onRowSelection" 
                             emptyTableText  = "No Data Found" 
                             width           = "740" 
                             sort            = "SERVER" 
                             iterator        = "<%= iterator %>" > 
            </htmlb:tableView> 

The dropdownlistbox value should be returned to 'fld4' in the code below.

The code in the 'OninputProcessing' event is as follows:-

 
data: tv          type ref to cl_htmlb_tableview, 
      tv_data     type ref to cl_htmlb_event_tableview, 
      value       type string, 
      fld4         type char20, 
      fld1         type char20, 
      inputfield  type ref to cl_htmlb_inputfield. 

tv ?= cl_htmlb_manager=>get_data( request = request 
                                 name = 'tableView' 
                                 id = 'tv_idint' ). 

if tv is not initial. 
  tv_data = tv->data. 

  if tv_data->prevselectedrowindex is not initial. 
    value = tv_data->get_cell_id( row_index = tv_data->prevselectedrowindex 
                                  column_index = '4'). 

    inputfield ?= cl_htmlb_manager=>get_data( request = request 
                                              name = 'inputField' 
                                              id = value ). 

    fld4 = inputfield->value. 

    value = tv_data->get_cell_id( row_index = tv_data->prevselectedrowindex 
                                  column_index = '1'). 

    inputfield ?= cl_htmlb_manager=>get_data( request = request 
                                              name = 'inputField' 
                                              id = value ). 

    fld1 = inputfield->value. 
  endif. 

endif. 

Column '1' in the tableView is a straight forward input field that allows the user to directly enter a value. In the code above this value is returned to 'fld1'. So it seems to be working for input fields, but not the dropdownlistbox field!

I have tried using the following to retrieve a value into 'fld4':-

 
data: dropDown    type ref to Cl_HTMLB_DropDownListBox. 

    dropdown ?= cl_htmlb_manager=>get_data( request = request 
                                              name = 'dropdownListBox' 
                                              id = value ). 

instead of:-

 
  inputfield ?= cl_htmlb_manager=>get_data( request = request 
                                              name = 'inputField' 
                                              id = value ). 

but with no luck!

I've looked at a few threads, blogs and wikis, such as:

Link:[]

Link:[https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/iterator%2bconcept]

Any help would be greatly appreciated

Thanks,

Nick.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

I've managed to find what the problem was with this.

In the constructor method of the iterator class the dropdownlistbox table was not being populated properly.

The dropdown table is based on structure IHTTPNVP, with fields NAME and VALUE. Both of these fields need to be populated. The NAME value is what is displayed to the user from the dropdown list. The VALUE is what is returned to the 'OnInputProcessing' event in field 'fld4' from the code in the above thread. Stupidly I did not populate the VALUE field, which explains why no value was returned!

The code in the iterator class constructor method should be as follows:-


data: wa_ddwn type IHTTPNVP.

  wa_ddwn-name = 'Change'.
  wa_ddwn-value = 'C'.
  append wa_ddwn to it_ddwn.

  wa_ddwn-name = 'Delete'.
  wa_ddwn-value = 'D'.
  append wa_ddwn to it_ddwn.

  get reference of it_ddwn into m_ddwn_ref.

In the RENDER_CELL_START of the iterator class the follwoing code should bind the dropdown values to the required field:-


case p_column_key.
  when 'FLD4'.
    if p_edit_mode is not initial.
      p_replacement_bee = cl_htmlb_dropdownlistbox=>factory( id = p_cell_id
                                                             selection = m_row_ref->fld4
                                                             table = me->m_ddwn_ref
                                                             nameofkeycolumn = 'VALUE'
                                                             nameofvaluecolumn = 'NAME').
    endif.

endcase.

The code in the 'OnIputProcessing' event in the above thread is correct.

Hope this helps someone!

Regards,

Nick.