[ABAP] ALV-Grid: Gitter-Zeile löschen

Variante 1 (Standard-Button)

-> Button cl_gui_alv_grid=>mc_fc_loc_delete_row muss in der Toolbar eingeblendet sein
-> die zugehörige interne Tabelle wird automatisch geupdated

Variante 2 (on_user_command)

* interne Tabelle it_itab muss global bekannt sein
METHOD on_user_command.
  CASE e_ucomm.
* Button-Kommando BTN_DEL_ROW abfangen
    WHEN 'BTN_DEL_ROW'.
      DATA: it_row_no TYPE lvc_t_roid.
      DATA: lv_flag TYPE boolean.

      sender->get_selected_rows( IMPORTING et_row_no = it_row_no ).

      IF lines( it_row_no ) > 0.
        SORT: it_row_no BY row_id.
        lv_flag = abap_false.

        LOOP AT it_row_no ASSIGNING FIELD-SYMBOL(<fs_row>).
          IF lv_flag = abap_false.
            DELETE it_itab INDEX <fs_row>-row_id.
            lv_flag = abap_true.
          ELSE.
            DELETE it_itab INDEX <fs_row>-row_id - 1.
          ENDIF.
        ENDLOOP.

        sender->refresh_table_display( ).
      ENDIF.
  ENDCASE.
ENDMETHOD.