Skip to Content
-2
Sep 28, 2019 at 07:17 AM

Select and deselect functionality in oops abap alv grid display

284 Views Last edit Sep 28, 2019 at 07:34 AM 2 rev

DATA: wa_out TYPE ty_out, " Output Table for Display

i_filter_entries TYPE lvc_t_fidx, " Filtered entries
l_tabix TYPE sy-tabix, " Index
l_valid TYPE c, " Flag
ls_stable TYPE lvc_s_stbl. " WA for LVC_S_STBL Note - 1. g_grid is the object reference for CL_GUI_ALV_GRID class. 2. it_out is the internal table for display. CALL METHOD g_grid->check_changed_data
IMPORTING
e_valid = l_valid. IF l_valid EQ 'X'. CALL METHOD g_grid->get_filtered_entries
IMPORTING
et_filtered_entries = i_filter_entries. LOOP AT it_out INTO wa_out.
l_tabix = sy-tabix.
READ TABLE i_filter_entries FROM l_tabix TRANSPORTING NO FIELDS.

IF sy-subrc IS NOT INITIAL.
wa_out-chk = 'X'.
MODIFY it_out INDEX l_tabix FROM wa_out TRANSPORTING chk.
ENDIF.
ENDLOOP. ls_stable-row = 'X'.
ls_stable-col = 'X'. CALL METHOD g_grid->refresh_table_display
EXPORTING
is_stable = ls_stable. ENDIF.

Doubt : By using above code its selecting every checkbox but when i unclick the checked check box and clicking the select button in custom toolbar again its not checking the checkbox.If manually uncheck the box and clicking the select button its not working and also given explanation on deselecting all the values(source code ) is better to understand.Thank you.