Для одного поля выглядит
здесь,
или здесь:
Для многих полей - выбираем весь список полей и применяем, те значения в варианте.
Code:
1. method on_std_function_afte.
2.
3. data lo_alv_ifc type ref to iwci_salv_wd_table.
4. data ls_config_in type if_salv_wd_table=>s_type_param_config_in.
5. data ls_config_out type if_salv_wd_table=>s_type_param_config_out.
6. data lo_model type ref to cl_salv_wd_config_table.
7. data lo_field type ref to cl_salv_wd_field.
8.
9. * Get the ALV interface controller
10. lo_alv_ifc = wd_this->wd_cpifc_alv_table( ).
11.
12. case r_param->id.
13. * Handle selection of an ALV view variant
14. when if_salv_wd_c_std_functions=>view_load " select view from view dropdown
15. or if_salv_wd_c_std_functions=>settings. " select view from settings > ok/apply
16.
17. * Determine what ALV view variant is currently selected
18. ls_config_in-action = if_salv_wd_table=>actual.
19. ls_config_out = lo_alv_ifc->get_config_data( ls_config_in ).
20.
21. * Process each ALV view variant as needed
22. case ls_config_out-view-description.
23. when 'MY_ALV_VIEW_VARIANT'.
24. * Fetch the field we will be creating a filter for
25. lo_model = lo_alv_ifc->get_model( ).
26. lo_field = lo_model->if_salv_wd_field_settings~get_field( 'FIELD_NAME' ).
27.
28. * Remove prior filter rules on the field
29. if lo_field->if_salv_wd_filter~t_filter[] is not initial.
30. lo_field->if_salv_wd_filter~delete_filter_rules( ).
31. endif.
32.
33. * Set new filter rule on the field
34. lo_field->if_salv_wd_filter~create_filter_rule(
35. operator = 'BT'
36. low_value = low_date_value
37. high_value = high_date_value ).
38.
39. when others. " other view variants
40.
41. endcase. " view variant
42.
43. when others. " other standard functions
44.
45. endcase. " ALV standard function
46.
47. endmethod.