如何限制SELECT-OPTIONS的选择屏幕的OPTION

REPORT Z_CONECT_A.

* Include type pool SSCR
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.

* 限制 WERKS 参数只能使用CP, GE, LT, NE.
  optlist-name = 'OBJECTKEY2'.
  optlist-options-cp = 'X'.
  optlist-options-ge = '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.

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值