
There are some cases where the job scheduling in SAP system required dynamic date range selection. Standard date selection from the system will only cater for normal job scheduling.
In this example, we will set up the variant which will set the ABAP program to run and fetch data in SAP system for past 2 months from today’s execute date.
1. Execute transaction code SE38 and fill in the ABAP program. Press F8 (Execute). The next screen will show you the program executable page.
2. Now, click on Save as Variant. Fill in all the necessary information such as the Variant Name, Description and etc.
3. On Objects for selection screen, look for Date Range. Under Selection Variable, double click or press F4 – choose D: Dynamic Date Calculation.
4. Next, under Name of Variable (Input Only Using F4), press F4 and select Current date – xxx, current date + yyy.
5. Specifically for this example, the data required is for the last 2 months – so, we need to put 60 as below screenshot.
6. Save your changes and you can now use the created variant when you schedule the job.
Note
Our post above might be very short and straight forward. You can also refer to below dynamic variant related article from the SAP Wiki.
https://blogs.sap.com/2012/07/24/dynamic-date-selection-in-variants/



