Write variant-specific code

We can write ABAP code that will be executed for a particular variant only.

For this, we use ABAP system fields from SYST structure.

Sample code is as follows:

      IF sy-slset = 'XI_SHARP_RESET'.
        gs_output-removal_flag = 'Y'.
      ELSE.
        gs_output-removal_flag = 'N'.
      ENDIF.

In the above code, removal flag is set to 'Y' only if program is run using variant name = 'XI_SHARP_RESET'.

For any other variant, it is set to 'N'.