cancel
Showing results for 
Search instead for 
Did you mean: 

delete the enteries in alv report

Junaidshaik284
Participant
0 Kudos
309

I want to delete the select records alv report and i used cl_salv_table class for displaying output. So tell me the logic how to implement it to delete it and display it again in same alv report.

Accepted Solutions (1)

Accepted Solutions (1)

raymond_giuseppi
Active Contributor

Look at demo report SALV_DEMO_TABLE_SELECTIONS

Junaidshaik284
Participant
0 Kudos

It is showing field values was empty, please tell me how to implement the logic with index for deleting multiple rows

lt_rows = lo_selections->get_selected_rows( ).

loop at lt_rows ASSIGNING FIELD-SYMBOL(<fs_rows>).

read table t_emp ASSIGNING FIELD-SYMBOL(<fs_emp>) index <fs_rows>.

if sy-subrc eq 0.
clear <fs_emp>.
endif.

ENDLOOP.
VXLozano
Active Contributor

You have multiple ways to do that. I'll provide you a hint to do it "my way":

  1. get the selected rows and put their keys into a secondary internal table
  2. loop at that secondary table and delete the corresponding rows from the grid's one
  3. refresh the grid (in this case, refresh( ) does not delete the content, but refresh the presentation grid)

Take a look at my comment in one of your other questions related to this development (is it a course's homework?). Split your development into as many problems (the monolitic ones) as you can, and solve them one by one. This site has an amazing utility called "search button" you can begin with (for each problem).

raymond_giuseppi
Active Contributor
  • Sorted type table, use vicen.lozano way
  • Not sorted type table, sort the list of selected row by index decreasing and then delete from last to first.
VXLozano
Active Contributor

Nice (second) approach. Never thought of it, or better told: never applied it. Mostly because I'm a sort of absentminded, and I'm sure I'll break something by doing that.

But it's the appropiate way to go with a standard table, thanks for put it there, maybe I'll grow a bit of confidence the next time I'll need to do that.

Junaidshaik284
Participant
0 Kudos

thank you so much raymond.giuseppi.

Answers (1)

Answers (1)

BhargavaReddy
Active Participant
0 Kudos

Hi,

Firstly google it for blogs or tutorials on the relevant topic before posting a question

go through the following tutorial for the SALV table

http://zevolving.com/category/salv-tutorial/