AT Events on selection screen SAP ABAP SYNTAX PART TWO

Addition 6

... ON BLOCK block

Effect

This event is assigned to the blocks on the selection screen defined by SELECTION SCREEN BEGIN/END BLOCK .
If the report starts an error dialog at this point, precisely these fields of the block block become ready for input again.

In which sequence are the events AT SELECTION-SCREEN ON psel ... , AT SELECTION-SCREEN ON RADIOBUTTON GROUP ... , AT SELECTION-SCREEN ON BLOCK ... , AT SELECTION-SCREEN processed?
The AT SELECTION-SCREEN ON psel ... events assigned to the parameters or selection options are executed in the sequence they are declared in the program, i.e. in the sequence they appear on the selection screen.
The events assigned to the radio button groups are executed according to the first parameter of the radio button group.
The events assigned to the blocks are executed "from the inside to the outside".

Example

 SELECT-OPTIONS SEL0 FOR SY-TVAR0.
 
SELECTION-SCREEN BEGIN OF BLOCK BL0.
  SELECT-OPTIONS SEL1 FOR SY-TVAR1.
 
  SELECTION-SCREEN BEGIN OF BLOCK BL1.
    PARAMETERS P0 RADIOBUTTON GROUP RADI.
    PARAMETERS P1 RADIOBUTTON GROUP RADI.
 
    SELECTION-SCREEN BEGIN OF BLOCK BL2.
      PARAMETERS P3.
    SELECTION-SCREEN END   OF BLOCK BL2.
 
    SELECT-OPTIONS SEL2 FOR SY-TVAR2.
 
  SELECTION-SCREEN END   OF BLOCK BL1.
 
SELECTION-SCREEN END   OF BLOCK BL0.

Sequence:

AT SELECTION-SCREEN ON...
SEL0
SEL1
RADIOBUTTON GROUP RADI
P3
BLOCK BL2
SEL2
BLOCK BL1
BLOCK BL0

AT SELECTION-SCREEN is executed at the very end.

Addition 7

... OUTPUT

Effect

This event is executed at PBO of the selection screen every time the user presses ENTER - in contrast to INITIALIZATION . Therefore, this event is not suitable for setting selection screen default values. Also, since AT SELECTION-SCREEN OUTPUT is first executed after the variant is imported (if a variant is used) and after adopting any values specified under SUBMIT in the WITH clause, changing the report parameters or the selection options in AT SELECTION-SCREEN OUTPUT would destroy the specified values.
Here, however, you can use LOOP AT SCREEN or MODIFY SCREEN to change the input/output attributes of selection screen fields.

Example

Output all fields of the SELECT-OPTION NAME highlighted:
 
SELECT-OPTIONS NAME FOR SY-REPID MODIF ID XYZ.
...
AT SELECTION-SCREEN OUTPUT.
  LOOP AT SCREEN.
    CHECK SCREEN-GROUP1 = 'XYZ'.
    SCREEN-INTENSIFIED = '1'.
    MODIFY SCREEN.
  ENDLOOP.
The addition MODIF ID XYZ to the key word SELECT-OPTIONS assigns all fields of the selection option NAME to a group you can read in the field SCREEN-GROUP1 . At PBO of the selection screen, all these fields are then set to highlighted.


RELATED POST

No comments :

Post a Comment