OOP ALV Set Filter Criteria

Introduction:

If you use OO ALV based on the class CL_GUI_ALV_GRID, then you can hide rows using the built-in filter functionality and manipulate the filter criteria from the program with modify the main Itab. 


in the above example based on the button selection set filter Criteria for Status fields.

Steps:

  • Add value to ALV filter Criteria 
IF GV_filter IS INITIAL. "filter set condition
   gs_filter-fieldname = 'STATUS'. "Field Name
   gs_filter-sign = 'I'.
   gs_filter-option = 'EQ'.
   gs_filter-low = '@0A@'. "Filter Value
   APPEND gs_filter TO gt_filter.

 ELSE. "Appned Green items to main ALV
   CLEAR :gt_filter[],
ENDIF.

  • Set ALV filter Criteria to ALV object 
CALL METHOD go_alvgrid->set_filter_criteria
EXPORTING
it_filter = gt_filter. 
 
  • Refresh ALV grid to apply filter;
 PERFORM alv_refresh. 
Previous
Next Post »
0 Komentar