abapdynprosap-selection-screens

Multiple exclude values in SELECT-OPTIONS?


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!


Solution

  • 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