Skip to Content
0
Former Member
Oct 25, 2004 at 11:40 AM

Tableview with multilineedit. How to read values from cells.

35 Views

Hi there,

I'm trying to create an application where the users can change / enter values in specific columns of a tableview - control. (HTMLB with ABAP).

I've encountered the following problem:

When the event "onRowSelection" is fired from the tableview, I process the tableview in "OnInputProcessing" to rescue the entered data into an internal table (which is the table used for the tableview).

The coding looks like this and works without any problem:

  IF event->name = 'tableView'.

    table_event ?= event.

    LOOP AT table_event->prevselectedrowindextable INTO line.
      READ TABLE itab INDEX line INTO wa_itab.
      input = table_event->get_cell_value( row_index = line
                                     column_index = 9 ).
      MOVE input TO wa_itab-inspk.
      MODIFY itab FROM wa_itab INDEX line.
    ENDLOOP.

  ENDIF.

This works perfect.

But when the user is ready with editing the data, he should be able to press a button on the page and the selected rows should be read a last time.

So I made the following coding "OnInputProcessing" when the button is pressed:

  IF event->name = 'button'.

    tv ?= cl_htmlb_manager=>get_data(
             request = runtime->server->request
             name    = 'tableView'
             id      = 'tableView1' ).
    table ?= tv->data.

    LOOP AT table->prevselectedrowindextable INTO line.
      READ TABLE itab INDEX line INTO wa_itab.
      input = table->get_cell_value( row_index = line
                                     column_index = 9 ).
      MOVE input TO wa_itab-inspk.
      MODIFY itab FROM wa_itab INDEX line.
    ENDLOOP.
  ENDIF.

But this time the table->get_cell_value methode is always empty. The prevselectedrowindextable contains the correct selected rows.

I think it's because the event wasn't fired by the tableview itself. But I don't know what I can do to get the actual edited values out of the tableview-cells.