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: 

Event while deleting a row in OO ALV GRID

Former Member
0 Kudos
785

Hi There,

I need to validate a row while deleting from an ALV grid and throw an error if that row can't be deleted. Right now I am doing it in the PAI of the screen in which ALV custom control is placed. Sequence of steps happening is…

- Delete a row

- Do some action

- Validation in PAI executed and an error message is displayed

But here unless I press enter or do other action the deleted line will not be appeared, is there any way to display this while issuing error message?

Thanks in advance,

Ram.

2 REPLIES 2

Former Member
0 Kudos
104

Hi Ram,

In the PAI use the method CHECK_CHANGED_DATA (Verification of Changes and Triggering of Event DATA_CHANGED) of the CLASS CL_GUI_ALV_GRID, which will trigger the data_changed event and the changes will be updated in the internal table.

DATA: g_alv_grid TYPE REF TO cl_gui_alv_grid.

In PAI of the screen call the below method

CALL METHOD g_alv_grid->check_changed_data.

Regards

Kesava

Former Member
0 Kudos
104

U can do all validations in the event data_changed_finished.

****----EVENT HANDLING.....*****

*------Class definition

CLASS lcl_event_handler DEFINITION .

PUBLIC SECTION.

METHODS handle_data_changed_finished FOR EVENT data_changed_finished

OF cl_gui_alv_grid IMPORTING e_modified ET_GOOD_CELLS.

ENDCLASS. "lcl_event_handler DEFINITION

*-----Class implementation

CLASS lcl_event_handler IMPLEMENTATION.

"handle_usercom

**----DATA changed

METHOD handle_data_changed_finished.

PERFORM handle_data_changed_finished USING e_modified

et_good_cells

.

ENDMETHOD.

ENDCLASS. "lcl_event_handler IMPLEMENTATION

FORM handle_data_changed_finished using i_modified type char01

i_good_cells type LVC_t_MODI.

data: wa_good_cells type lvc_s_modi.

// Perform ur validation here

endform.