主要代码: gr_alvgrid TYPE REF TO cl_gui_alv_grid, METHODhandle_user_command.DATA:lv_contTYPE..." />
当前位置: 代码迷 >> 综合 >> OOnbsp;ALVnbsp;用户过滤数据后…
  详细解决方案

OOnbsp;ALVnbsp;用户过滤数据后…

热度:71   发布时间:2024-01-18 13:37:56.0
ALV显示后,如果用户做了筛选,然后点击全选或者取消全选,不应该影响过滤掉的数据
OO <wbr>ALV <wbr>用户过滤数据后点全选 <wbr>全部取消选择的处理方法
主要代码:
gr_alvgrid  TYPE  REF  TO  cl_gui_alv_grid ,  

  METHODhandle_user_command.
 
   
DATA: lv_cont            TYPE i,
          lv_tabix          
TYPE sy-tabix.
 
        
DATA: lt_filtered        TYPE lvc_t_fidx.
 
   
CASE e_ucomm.
     
WHEN 'ALL'.
       
CALL METHOD gr_alvgrid->get_filtered_entries
         
IMPORTING
            et_filtered_entries
= lt_filtered.
 
       
LOOP AT it_tabla INTOwa_tabla.
          lv_tabix
= sy-tabix.
         
READ TABLE lt_filtered WITH KEYTABLE_LINE = lv_tabix TRANSPORTING NO FIELDS.
         
IF sy-subrc NE 0.
           
wa_tabla-checkbox = 'X'.
           
MODIFYit_tabla FROM wa_tabla INDEX lv_tabix.
         
ENDIF.
       
ENDLOOP.
 
     
WHEN 'NONE'.
       
CALL METHOD gr_alvgrid->get_filtered_entries
         
IMPORTING
            et_filtered_entries
= lt_filtered.
 
       
LOOP AT it_tabla INTOwa_tabla.
          lv_tabix
= sy-tabix.
         
READ TABLE lt_filtered WITH KEYTABLE_LINE = lv_tabix TRANSPORTING NO FIELDS.
         
IF sy-subrc NE 0.
           
CLEAR  wa_tabla-checkbox.
           
MODIFYit_tabla FROM wa_tabla INDEX lv_tabix.
         
ENDIF.
       
ENDLOOP.
 
   
ENDCASE.
 
        
CALL METHOD gr_alvgrid->refresh_table_display.
 
ENDMETHOD.                           "handle_user_command