选择选项排除值

时间:2018-07-04 16:05:16

标签: sap abap

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.

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

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

我尝试了上述方法不起作用。有关如何执行此操作的任何建议? 预先感谢!

2 个答案:

答案 0 :(得分:3)

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

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' )
 ).

答案 1 :(得分:1)

尝试一下:

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'

在需要时,用户应修改选择项。

希望有帮助