Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to Delete multiple records in ALV GRID where I have check box??

Former Member
0 Kudos

Hello Experts,

Hope you people are doing good.

I am facing an issue which i would like to mention below.

I am displaying a ZTABLE data by using an ALV GRID,in the GRID where I have a check box option to DELETE the selected rows..But the problem what I am facing is "If I select the multiple records by using the check box option and then when I tried to DELETE **only one record is deleting**..

I am providing my code below....Please help me out...

WHEN 'DELETE'.

      READ TABLE t_zbacklog INTO wa_zbacklog INDEX rs_selfield-tabindex.

      DELETE zbacklog FROM wa_zbacklog.

      IF sy-subrc = 0.

        MESSAGE 'Data Deleted successfully, Please Refresh it' TYPE 'I'.

      ENDIF.

*******and this is how I created the check box in Field catalog********

w_fcat-col_pos = 0.

  w_fcat-tabname = 'T_ZBACKLOG'.

  w_fcat-fieldname = 'CHKBX'.

  w_fcat-checkbox = 'X'.

  w_fcat-edit = 'X'.

  w_fcat-outputlen = 2.

  APPEND w_fcat TO t_fcat.

  CLEAR w_fcat.

Regards,

Naveen.

6 REPLIES 6

Former Member
0 Kudos

Friends,

If any watch this querry please help me out with the correct solution because as it is high priority report for me..

Clemenss
Active Contributor
0 Kudos

in the user command exit:

DELETE zbacklog WHERE chkbox IS NOT INITIAL.

rs_selfield-refresh = abap_true.

Former Member
0 Kudos

WHEN 'DELETE'.

DELETE zbacklog WHERE chkbx is NOT INITIAL.

       rs_selfield-refresh = abap_true.


I tried like this but it is showing "Unable to interpret "WHERE".Possible causes:Incorrect spelling or comma error.

Clemenss
Active Contributor
0 Kudos

Sorry,

it is

DELETE t_zbacklog WHERE chkbx is NOT INITIAL.

  rs_selfield-refresh = abap_true.


Regards,


Clemens

Former Member
0 Kudos

No buddy it's not working.Now even one record also not deleting as I commented this:READ TABLE t_zbacklog INTO wa_zbacklog INDEX rs_selfield-tabindex.

I wrote like this as you said.

WHEN 'DELETE;.

DELETE t_zbacklog WHERE chkbx is NOT INITIAL.

       rs_selfield-refresh = 'X'.






fredericbasilius
Participant
0 Kudos

Hi Naveen,

Try this,

When 'DELETE'.

call the method 'CHECK_CHANGED_DATA' using the grid object, then delete them using the solution provided by Clemens Li.

Regards,

FB