LECT-OPTIONS,可以用 NO-EXTENSION和NO INTERVALS做一些输入的限制,可以用下面的方法做更进一步的限制。如:
REPORT z_limit_select .
TYPE-POOLS sscr.
TABLES : sflight.
SELECT-OPTIONS : s_carrid FOR sflight-carrid,
s_connid FOR sflight-connid.
DATA: restrict TYPE sscr_restrict,
optlist TYPE sscr_opt_list,
ass TYPE sscr_ass.
INITIALIZATION.
optlist-name = ‘OBJECTKEY1’.
optlist-options-eq = ‘X’.
optlist-options-bt = ”.
APPEND optlist TO restrict-opt_list_tab.
ass-kind = ‘S’.
ass-name = ‘S_CARRID’.
ass-sg_main = ‘I’.
ass-sg_addy = space.
ass-op_main = ‘OBJECTKEY1’.
APPEND ass TO restrict-ass_tab.
CLEAR optlist.
CLEAR ass.
optlist-name = ‘OBJECTKEY2’.
optlist-options-cp = ‘X’.
optlist-options-ge = ‘X’.
optlist-options-lt = ‘X’.
optlist-options-ne = ‘X’.
optlist-options-eq = ‘X’.
optlist-options-bt = ‘X’.
APPEND optlist TO restrict-opt_list_tab.
ass-kind = ‘S’.
ass-name = ‘S_CONNID’.
ass-sg_main = ‘I’.
ass-sg_addy = space.
ass-op_main = ‘OBJECTKEY2’.
APPEND ass TO restrict-ass_tab.
CALL FUNCTION ‘SELECT_OPTIONS_RESTRICT’
EXPORTING
restriction = 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.
*NO-EXTENSION
*NO INTERVALS
*BT SELECT-OPTIONS: 活动范围
*CP 选项: 活动模式
*EQ 选项: 单一活动值
*GE 选项: 大于或等于
*GT 选项: 大于
*LE 选项: 小于或等于
*LT 选项: 小于
*NB SELECT-OPTIONS: 排除范围激活
*NE SELECT-OPTIONS: 单值活动除外
*NP 选项: 活动的模型除外
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/19984.html