0
votes

Before starting development I'm looking for a standard way of doing something like that: I need to implement user-friendly way for ordering table rows in standard Dynpro ALV grid. I think it should look like a form where filter columns are defined, like it implemented, for example, in standard function module LVC_FILTER.

1
I have to admit I don't even understand the question. Parser failure.vwegert
Hey, vwegert. I even do not read anything ending with a question mark.icbytes
Is there standard sap function or library which change order of table rows through drag and drop? Or required something better then arrow up and down.IvanRyazanov
table rows as in "internal table" can only be sorted through code, at least if we ignore sorted tables. But UI controls like the ALV grid allow sorting both by code and by user settings.Dirk Trilsbeek
In some case right order does not match a simply sort table. Only user know as permutation rows.IvanRyazanov

1 Answers

0
votes

No, there is no standard functionality for this. However you can do this (manual table sort by drag-and-drop) programmatically by inserting/deleting itab rows in runtime. This can be be implemented using standard ALV events: ondrag, ondrop, and ondropcomplete. Try these code samples for implementing methods:

method handle_grid_ondrag.

data: data_object type ref to drag_drop_object,
      help_row like line of gt_outtab.                  "#EC NEEDED

      read table gt_outtab_2 into help_row index es_row_no-row_id.
      create object data_object.
      move es_row_no-row_id to data_object->index.
      read table gt_outtab_2 into data_object->wa_test index
      es_row_no-row_id.
      e_dragdropobj->object = data_object.

endmethod.     

_

method handle_grid_ondrop.

data: data_object type ref to drag_drop_object,
      drop_index type i,
      help_row like line of gt_outtab.                  "#EC NEEDED

      delete gt_outtab_2 index data_object->index.
      insert data_object->wa_test into gt_outtab_2 index e_row-index

endmethod.

_

 method handle_grid_ondropcomplete.

  if data_cel = ' '.
    call method grid->refresh_table_display.
  endif.

endmethod.

Refer to sample program BCALV_TEST_DRAG_DROP_02 if you have difficulties.