Skip to Content
Author's profile photo Former Member

Dynamic Variant for Date Range

Dynamic Variant for Date Range

Making the Variant for Date or Date Range Dynamic in the Selection Screen of any Program.

There are actually many ways you can make the Variant for Dateu2019s Dynamic.

1.     Providing the Values in the Variant Variables.

2.     By creating the variables in the table TVARVC

3.     By Initializing the values in the program itself.

I saw many posts with respect to these and found that everyone has their own way of dealing. Even I wrote code in the program initialization to get this done.

Here in this post I am showing you the easiest option which is available in the Variant creation.

EX : If you want to execute the batch job based on a date range.

     SY-DATE u2013 60 days , that means always your program should execute the batch job based on System Date. And the variant should change accordingly.

Following are the step by stop to do that.

1. Select your program and select the Variant Radio button and then Click on Display.

2. It will pop up a screen with variant option below the program name.

3. Enter the Variant name and click on Create

4. You will see a screen, with the Attributes button.

5. Once you click on the Attributes button, it will take you a screen with selection option.

6. In my scenario my input is based on Calender Day, so select the Selection Variable for Calender Day: You will find 2 options T & D.

7. Select D: Dynamic date Calculation, then select the Name of Variable (input using f4). You can find many options.

8. Scroll down the Variant Attributes and select current date u2013 xxx, current date + yyy

9.Though it seems to be inactive, just double click on the row to provide the date range.

10. Just enter the value for xxx and yyy to get you dynamic range based on number of days

11. In my scenario I have to consider System Date u2013 60 days. 0 means current day.

12. Click on OK to check the range has been reflected or not. Then save the Variant and check the value by executing the program with saved Variant.

You can check the same in blog with all the screen shots attached but this thing is so easy you don’t require screen shots.

Regards

Shankar Chintada

Assigned Tags

      3 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Benedict Venmani Felix
      Benedict Venmani Felix

      A little more effort with screen shots would be appreciated.

      Benedict

      Author's profile photo Raman Korrapati
      Raman Korrapati

      Thanks for making useful doc. if you provide with screen shots as stated by vasanth, its more helpful article.

      Thanks

      Author's profile photo Former Member
      Former Member

      Thanks, this was a great help.