Copyright 2024 - BV TallVision IT

A selection screen has Process Before Output, Process After Input, Process On Value Request and Process On Help Request... This is an overview of processing events that apply to selection screens, in time sequence:

INITIALIZATION.
AT SELECTION-SCREEN OUTPUT.
AT SELECTION-SCREEN ON HELP-REQUEST.
AT SELECTION-SCREEN ON VALUE-REQUEST.
AT SELECTION-SCREEN.
START-OF-SELECTION.
END-OF-SELECTION. 
  1. INITIALIZATION. executed first: whenever a program starts, this event is done first, even befor setting up the selection screen hence if there are parameters or select options to be defaulted at runtime, here is where you should do that. Defaults that were set up on the PARAMETER statement can be overwritten here
  2. AT SELECTION-SCREEN OUTPUT. when the selection screen is build up, the Process Before Output is done in this event, change the appearance of your parameter fields (e.g. make them read only) here
  3. AT SELECTION-SCREEN ON HELP-REQUEST and AT SELECTION-SCREEN ON VALUE-REQUEST will be executed when the selection screen is displayed and the end user presses F1 or F4 on a certain field
  4. AT SELECTION-SCREEN. this is where you can check the values entered on the screen, just throw an error if values or combinations of values are not correct, or even when values are missing. This method also allows the ABAP to respond to user menu actions on the selection screen, e.g. through buttons that were put on the application toolbar with SELECTION-SCREEN FUNCTION KEY: 1, 2, 3, 4, 5. or SELECTION-SCREEN PUSHBUTTON 1(30) pushbut1 USER-COMMAND SIMULATE.. The field SSCRFIELDS-UCOMM. will hold the action code (okcode).
  5. START-OF-SELECTION. is the first bit of logic that is started after pressing "Execute" (F8) on the selections screen...
  6. END-OF-SELECTION. In regular reporting: when all data selections are done, the gathered informtion is output in some way. Producing output is commonly done in the END-OF-SELECTION event.

Would you like to see all of the above events in action ?

REPORT  Z_SELECTIONSCREEN_EVENTS.

TABLES: mara, SSCRFIELDS.

PARAMETERS: p_param modif id MIF.
SELECT-OPTIONS: s_matnr FOR mara-matnr.

* Allow the end user to press F4 on your parameter field:
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_param.

  message i123(zum) with 'Value requested...'.

* Allow the end user to press F1 on your parameter field:
AT SELECTION-SCREEN ON HELP-REQUEST FOR p_param.

  message i123(zum) with 'Help requested (for field)'.

* Allow the end user to press F1 on whole selection screen
AT SELECTION-SCREEN ON HELP-REQUEST FOR s_matnr.

  message i123(zum) with 'Help requested (for field)'.

* Allow logic on PROCESS BEFORE OUTPUT for the selection screen
* (e.g. to change settings on the fields displayed).
AT SELECTION-SCREEN OUTPUT.
* E.g.: disable input for the fields with MODIF ID "MIF":
  loop at screen.
    CHECK SCREEN-GROUP1 EQ 'MIF'.
    SCREEN-INPUT = '0'.
    MODIFY SCREEN.
  endloop.

* Handle menu actions from the selection screen, e.g. pushbuttons
* 1 to 5 (FC01 to FC05) or own defined buttons on the screen...
AT SELECTION-SCREEN.

  CASE SSCRFIELDS-UCOMM.
    when 'FC01'.
* Do something
  ENDCASE.

* Last but really first:
INITIALIZATION.

* Set runtime defaults for your parameters (or select options) here:
p_param = 'Y'.