Dynamic Variant Creation:
What is Variants?
Variants allow you to save sets of input values for programs that you often start with the same selections.
Purpose of dynamic variants
Sometimes you may have a requirement to schedule a back ground jobs, based on the current month in the selection screen.
Ex: You want to run your Payroll interface based on the pay periods, so you may need to have a variant for different month.
To overcome the above scenario, SAP has given more flexibility to do the things. Here in this document, I will cover how to create variant that changes dynamically based on the calendar month.
Variant creation Steps
Transaction code for creating report variant: SE38
- 1. Go to SE38, enter the report program name and select radio buttons “variants” and press Display
Note: There are few different ways of creating report variants, out of which below example is one way of doing it.
2. Enter desired variant name, in below screen represented as “DEMO_DYNAMIC” and Press Create.
3. You will be taken to the below screen, press Attributes button to maintain your dynamic variables.
4. Go to selection variable (as shown below) and press F4 (value help) and select D (i.e. for dynamic date calculation)
5. Press F4, under “Name of Variable (input Only Using F4), you will be taken to the below highlighted screen.
6. You choose the respective variable that suits your requirement.
Now, Let us assume that in our scenario we want to select the date range for start day of previous month and end day of current month.
Double click the variable that matches our scenario (as shown below)
On pop-up screen enter the value as shown in below screen.
Here XXX = 1 represents, [current month – 1].
YYY = 0 represents, [current month + 0].
7. Press Save.
8. Now you will see the desired results.