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'.
gs_output-removal_flag = 'N'.
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'.