Loading a default/user based selection screen variant on report initialization can be a nice feature for your users. With this little snippet you can enable loading a predefined user variant U_<sy-uname> when a report is being initialized.

To achieve this, you just need to execute the function module RS_SUPPORT_SELECTIONS in the INITIALIZATION block of your report. To make this snipped reusable, just copy the following code into an include (e.g. ZCA_DEFAULT_VARIANT):

1
2
3
4
5
6
CALL FUNCTION 'RS_SUPPORT_SELECTIONS'
  EXPORTING
    report  = sy-repid
    variant = CONV rsvar-variant( |U_{ sy-uname }| )
  EXCEPTIONS
    OTHERS  = 0.    " just to ignore if there is no variant

You can include this into every report which should automatically load a user variant on intialization:

1
2
3
4
5
6
7
8
9
REPORT ztest.

************************************************************************
* INITIALIZATION
************************************************************************
INITIALIZATION.
  INCLUDE zca_default_variant.

...