限制selection-option范围设置

来源:互联网 发布:js数组push进前面 编辑:程序博客网 时间:2024/06/05 05:47
REPORT z_zcd_014.

TYPE-POOLS sscr.
TABLES : marc.
*定义选择屏幕
SELECT-OPTIONS :
s_matnr FOR marc-matnr,
s_werks FOR marc-werks.
* Define the object to be passed to the RESTRICTION parameter
DATA restrict TYPE sscr_restrict.
* Auxiliary objects for filling RESTRICT
DATA : optlist TYPE sscr_opt_list,
           ass TYPE sscr_ass.


INITIALIZATION.
* 限制MATNR参数只能使用‘EQ’ 和‘BT’.
  optlist-name = 'OBJECTKEY1'.
  optlist-options-eq = 'X'.
  optlist-options-bt = 'X'.
  APPEND optlist TO restrict-opt_list_tab.
  ass-kind = 'S'.
  ass-name = 'S_MATNR'.
  ass-sg_main = 'I'.
  ass-sg_addy = space.
  ass-op_main = 'OBJECTKEY1'.
  APPEND ass TO restrict-ass_tab.
  CLEAR : optlist,ass.
* 限制 WERKS 参数只能使用CP, GE, LT, NE.
  optlist-name = 'OBJECTKEY2'.
  optlist-options-eq = 'X'.
  optlist-options-gt = 'X'.
  optlist-options-lt = 'X'.
  optlist-options-ne = 'X'.
  APPEND optlist TO restrict-opt_list_tab.
  ass-kind = 'S'.
  ass-name = 'S_WERKS'.
  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.
0 0