Problem: you want to restrict user from using certain Select-Options features.
Solution: you can achieve this by a simple code in the right place.
Below code presents an example of disallowing user to choose certain features from Select-Options field called S_PARAM. In this case user will be allowed to choose only the „between” and „equal” type values for the field. If you want this to work for the Selection Screen
type-pools:
abap.
data:
ls_ass type sscr_ass,
ls_options type sscr_opt_list,
ls_restrict type sscr_restrict.
ls_options-name = 'S_PARAM'.
ls_options-options-bt = abap_true.
ls_options-options-eq = abap_true.
append ls_options to ls_restrict-opt_list_tab.
ls_ass-kind = 'S'.
ls_ass-name = 'S_PARAM'.
ls_ass-sg_main = 'I'.
ls_ass-sg_addy = ' '.
ls_ass-op_main = 'S_PARAM'.
append ls_ass to ls_restrict-ass_tab.
call function 'SELECT_OPTIONS_RESTRICT'
EXPORTING
restriction = ls_restrict
EXCEPTIONS
too_late = 1
repeated = 2
selopt_without_options = 3
selopt_without_signs = 4
invalid_sign = 5
empty_option_list = 6
invalid_kind = 7
repeated_kind_a = 8
others = 9.
You need to put this code in the INITIALIZATION or AT SELECTION SCREEN OUTPUT event, for it to work for Selection Screen.
Komentowanie jest zakończone.