Kevin Mueller
Kevin Mueller

Reputation: 668

Delete specific row in ALV?

I want to delete a specific row in a table. I identified the row before using get_selected_rows. Now I have the row identified in gt_rows.

Now I want to delete that row. I just can't get it done. Here's my current code:

    go_selec = go_alv->get_selections( ).   "gt_rows
    CALL METHOD go_selec->get_selected_rows
      RECEIVING
        value = gt_rows.
      *Here the row should get deleted.

The name of the database Table is "zrtable" and the name of the internal table is it_table. The name of the structure is ls_table. I'm a beginner so a bit of code would be awesome. :)

Upvotes: 0

Views: 2371

Answers (1)

Gurkan Yilmaz
Gurkan Yilmaz

Reputation: 1

gt_rows table holds index data of the rows which selected.

Now you have to loop at your index table to read these lines.

LOOP AT gt_rows ASSIGNING FIELD-SYMBOL(<index>).
  READ TABLE it_table ASSIGNING FIELD-SYMBOL(<table_line>) INDEX <index>. 
  IF <table_line> IS ASSIGNED.
    CLEAR <table_line>.
  ENDIF.
ENDLOOP.

Also instead of READ TABLE, you can use,

DATA(line) = it_table[ index ].

Think field-symbols as pointers, you directly access to data using them, so they point the reference not value.

Upvotes: 0

Related Questions