Selection Screen with Push Button

If you need something like variant and want to control it, the push button on the selection screen can be the right solution.
The a sample selection screen with an extra push button and simple logic:
screenshot
Here the source code:
DATA:
  gv_dummy_bukrs    TYPE bukrs,
  gv_dummy_saknr    TYPE saknr.

SELECT-OPTIONS:
  so_bukrs FOR gv_dummy_bukrs.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(30) FOR FIELD so_saknr.
SELECT-OPTIONS:
  so_saknr FOR gv_dummy_saknr.
SELECTION-SCREEN PUSHBUTTON 83(6) text-t01 USER-COMMAND saknr_upload. " set text-t01 as 'Upload'
SELECTION-SCREEN END OF LINE.

AT SELECTION-SCREEN.

  IF sy-ucomm = 'SAKNR_UPLOAD'.
    clear so_saknr[].
    so_saknr-sign = 'I'. so_saknr-option = 'EQ'. so_saknr-low = '0011000000'. append so_saknr.
    so_saknr-sign = 'I'. so_saknr-option = 'EQ'. so_saknr-low = '0012000000'. append so_saknr.
    so_saknr-sign = 'I'. so_saknr-option = 'EQ'. so_saknr-low = '0013000000'. append so_saknr.
  ENDIF.

START-OF-SELECTION.

  SELECT saknr INTO gv_dummy_saknr
    FROM ska1
    WHERE
      saknr IN so_saknr.

    WRITE: / gv_dummy_saknr.
  ENDSELECT.
See other related notes in my infodepot:
Tabbed block at selection screen - returning to previous selected tabstrip Saving and restoring selected radio buttons on selection screen
Full list of examples in my infodepot

If you have a question, have found an error or just want to contact me, please use this form.

Copyright (C) 2020 http://www.kerum.pl/infodepot/

Disclaimer: I am not affiliated or related to any division or subsidiary of SAP AG.
Trademarks or registered trademarks of any products or companies referred to on this site belong to those companies.
Anyone using the given solutions, is doing it under his/her own responsibility and at own risk.