REPORT ztest_restrict_so.
TYPE-POOLS:sscr.
TABLES : pa0001.
"Selection-screen
SELECT-OPTIONS :
s_pernr FOR pa0001-pernr.
"Types
TYPES:
ty_so_restrict TYPE sscr_restrict,
ty_so_opt_list TYPE sscr_opt_list,
ty_sscr_ass TYPE sscr_ass.
"Work areas
DATA:
wa_so_restrict TYPE ty_so_restrict,
wa_so_opt_list TYPE ty_so_opt_list,
wa_sscr_ass TYPE ty_sscr_ass.
"Internal tables
DATA:
it_so_restrict TYPE ty_so_restrict,
it_so_opt_list TYPE ty_so_opt_list.
INITIALIZATION.
wa_so_opt_list-name = 'OBJECTKEY1'.
wa_so_opt_list-options-eq = 'X'.
wa_so_opt_list-options-bt = 'X'.
APPEND wa_so_opt_list TO it_so_restrict-opt_list_tab.
wa_sscr_ass-kind = 'S'.
wa_sscr_ass-name = 'S_PERNR'.
wa_sscr_ass-sg_main = 'I'.
wa_sscr_ass-sg_addy = space.
wa_sscr_ass-op_main = 'OBJECTKEY1'.
APPEND wa_sscr_ass TO it_so_restrict-ass_tab.
CALL FUNCTION 'SELECT_OPTIONS_RESTRICT'
EXPORTING
restriction = it_so_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.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
1 comment :
Muy interesante. Muchas gracias. No sabía que existiese un módulo de funciones que restringiese las funciones del SELECT-OPTIONS
Oscar
Post a Comment