Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Avoding Server Request on tableView MULTIEDIT

Hi All,

Is it possible to avoid server roundtrip when a line is selected from tableview onSelect="multilineEdit" ?

I have multiple tab strips, and on the third tab I have a table where the users can input info using dropdowns. However, everytime I select a line, the page refreshes and takes me back to the first tab with all tableView input lost.

Thanks!

Roman D.

replied

You can use the following approach show in the code below:

CLASS CL_HTMLB_MANAGER DEFINITION LOAD.

* Optional: test that this is an event from HTMLB library.
IF event_id = CL_HTMLB_MANAGER=>EVENT_ID.

* See if upload is triggered from button
  DATA: event TYPE REF TO CL_HTMLB_EVENT.
  event = CL_HTMLB_MANAGER=>get_event( runtime->server->request ).

if  event->id = 'but1' and event->event_type = 'click'.
  DATA: tv TYPE REF TO CL_HTMLB_TABLEVIEW.
  tv ?= CL_HTMLB_MANAGER=>GET_DATA(
                  request      = runtime->server->request
                  name         = 'tableView'
                  id           = 'tab1' ).

IF tv IS NOT INITIAL.

 DATA: tv_data TYPE REF TO CL_HTMLB_EVENT_TABLEVIEW.
  tv_data = tv->data.
refresh itab2.
refresh itab3.


 call method tv_data->GET_ROWS_SELECTED
      receiving selected_rows = itab2.

 endif.
data : ind type SELECTEDROW,
       row_s type row.

if itab2 is not initial.
    data :rw LIKE LINE OF itab.

    loop at itab2 into ind.
      READ TABLE itab INDEX ind-index into
      rw.
       if rw is not initial.
       row_s = rw.
      append row_s to itab3.
      clear row_s.
      endif.
    endloop.
 endif.
Endif.

Itab2 type selectedrows.

in page attributes.

itab2 will contain the index of the selected rows in the table you are displaying say itab. Now your itab3 should also be as same type of itab. According to the code above, itab3 contains the selected rows from the itab.

All the selection happens in a single round trip in this approach.

Hope I am clear. If not you can revert back.

Hope this helps,

Regards,

Ravikiran.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question