SELECT-OPTIONS 中的多个排除值

Multiple exclude values in SELECT-OPTIONS

selection-screen begin of block b4 with frame title text-b04.
select-options: s_matkl for t023-matkl default 'Z310'.
selection-screen end of block b4.

我必须为 material 组创建一个新的初始选择,并将排除垫组 Z310Z320 设置为默认视图。但是,在需要时,用户应该能够包含 Z320

INITIALIZATION.
s_matkl-sign = 'E'.
s_matkl-option = 'EQ'.
s_matkl-high = 'Z310'.
s_matkl-low ='Z320'.
MODIFY s_matkl.

我试过上面的 working.Any 关于如何做到这一点的建议? 提前致谢!

试试这个:

data g_matkl like t023-matkl.

selection-screen begin of block b1 with frame title text-b01.
select-options: s_matkl for g_matkl.
selection-screen end of block b1.

INITIALIZATION.
  s_matkl-sign = 'E'.
  s_matkl-option = 'EQ'.
  s_matkl-low = 'Z310'.
  APPEND s_matkl. " <----------- 'APPEND' instead of 'MODIFY'

  s_matkl-sign = 'E'.
  s_matkl-option = 'EQ'.
  s_matkl-low = 'Z320'.
  APPEND s_matkl. " <----------- 'APPEND' instead of 'MODIFY'

需要时,用户应修改 SELECT-OPTIONS。

希望对您有所帮助

如果您使用的是较新的版本,以下内容更简洁:

DATA gv_matkl TYPE t023-matkl.
select-options: gt_matkl for gv_matkl.

INITIALIZATION.
 gt_matkl[] = VALUE #(
  ( sign = 'E' option = 'EQ' low = 'Z310' )
  ( sign = 'E' option = 'EQ' low = 'Z320' )
 ).