Application Development and Automation 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: 
Read only

Problem with an editable alv

Former Member
0 Likes
797

Hi,

I have an editable alv with a delete button in the editable alv .

When I click on the delete button , I want to give a pop up which says whether you want to delete the data or not .

If yes , I will allow the system to delete the data .

If no, it should not delete the data .

There is a method called handle_data_changed in the alv , but data is getting deleted from the alv even before going to this method .I checked it in the debugger .

Please could someone help me out with how I can perform this task?

Regards,

Sushanth H.S.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
775

Hi Chitra,

I have already done this .

I put a break-point in the event handle_data_changed and found that the data is getting deleted from the alv-grid even before coming to this event .

Regards,

Sushanth H.S.

Hi,

I have an editable alv with a delete button in the editable alv .

When I click on the delete button , I want to give a pop up which says whether you want to delete the data or not .

If yes , I will allow the system to delete the data .

If no, it should not delete the data .

There is a method called handle_data_changed in the alv , but data is getting deleted from the alv even before going to this method .I checked it in the debugger .

Please could someone help me out with how I can perform this task?

Regards,

Sushanth H.S.

6 REPLIES 6
Read only

Former Member
0 Likes
775

Hi Sushanth,

As per my understanding, You will have a check box to select the data that is to be deleted.

So when you select , the Final table that is used to display the ALV gets automatically changed.

In that event , ( dont forget to register tat event )

get the selected rows

raise a pop up for confirmation

Delete the records.

Regards,

Chitra

Read only

Former Member
0 Likes
775

Hi Chitra,

I want to know which is the event that has to be registered?

Regards,

Sushanth H.S.

Read only

0 Likes
775

Hi Sushanth,

do this.

Add this to your code.

**- Register events

CALL METHOD o_alvgrid->register_edit_event

EXPORTING

i_event_id = cl_gui_alv_grid=>mc_evt_enter.

CALL METHOD o_alvgrid->register_edit_event

EXPORTING

i_event_id = cl_gui_alv_grid=>mc_evt_modified.

**- Event Receiver

CREATE OBJECT o_event_receiver.

SET HANDLER o_event_receiver->handle_data_changed FOR o_alvgrid.

Regards,

Chitra

Read only

Former Member
0 Likes
776

Hi Chitra,

I have already done this .

I put a break-point in the event handle_data_changed and found that the data is getting deleted from the alv-grid even before coming to this event .

Regards,

Sushanth H.S.

Read only

0 Likes
775

Hi Sushanth,

Try this.

Type /h which starts t debugging mode when in the ALV GRID.

You select the row that is to be deleted in the ALV grid and click on the grid.

this is because the Event Handle_data_changed will initiate only after a operation after selecting the data.

This will lead to the code part where you hav written the Method.

Revert if any issues.

Regards,

Chitra

Read only

0 Likes
775

try calling the before_user_command event... and in that check whether the delete button has been pressed. if yes, show the popup... if the user selects "No" then change the e_ucomm to space so that nothing happens after this event.

Hope this helps.

Thanks,

Balaji