Multiple exclude values in SELECT-OPTIONS?

6.6k Views Asked by At

I have to create a new initial selection for the material group and set as default view one with excluded mat groups Z310 and Z320. However, when needed, the user should be able to include Z320

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.

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

I tried the above its not working. Any suggestions on how I can do this?

Thanks in advance!

2

There are 2 best solutions below

9
Nelson Miranda On BEST ANSWER

Try this:

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'

When needed the user should modify the SELECT-OPTIONS.

Hope it helps

4
peterulb On

If you are on newer releases, the following is a bit more concise:

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