Dynamic Date Selection in Variants
Dynamic Date Selection in Variants
As seen on above screen there are few functions available as SAP standard in variant attributes. E.g.
- Only for Background Processing: If you select the field Background only, the variant can only be executed in
the background. Otherwise, it can be run both in the background and online.
- Protect Variant: If you select this field, the variant can only be changed by the person who created it or last
changed it.
Based on requirement one can select/deselect it.
Search for the field on which a dynamic/variable date needs to be setup. Go to column-Type of selection
variable (Third from right hand side) and click on the dropdown icon or press F4 to show the popup menu for
the selection variable.
Double-click on the line D for dynamic date calculation. Selecting 'type of variable' is nothing
but we are declaring the field which need dynamic date calculation.
To mention a dynamic value, we need to select a Variable. Click on the dropdown icon or press F4 on columnName of variable to show available selection variables.
You need to select a sign field which allows to enter either "I" or "E".
"I" (Inclusive) means that the single value or range you specified is selected itself.
"E" (Exclusive) means that the single value or range you specified is excluded from the selection.
The default is "I".
Along with the sign field, need to select 'Option'. With the operators in this field, you specify whether the
entered values are to be used as a single value, range, or search string for limiting data selection. Possible
operators are: EQ- Equal: Single Value, NE- Not Equal: Everything Apart from the Specified Single Value, LELess or EQUAL: Everything <= Value in Field LOW, GT- Greater Than: Everything > Value in Field LOW, GEGreater or Equal: Everything >= Value in Field LOW and LT-Less Than: Everything < Value in Field LOW.
Similarly, you can even choose other operators and check effect.
I chose option operator as 'Less Than' and variable as 'Current Date +/- ??? days'. System will come up with a
pop-up window and ask value for days.
Put value with sign - in order to have date in past from current date whereas sign + for future
date.
In addition to above, we can chose a variable to set a date range. For the same, choose Variable
name: Current date xxx, current date + yyy.
Press Enter.
And you will see dates as per Variable selected (shown below).
Ananth Thiruvengadam
Feb 19, 2016 10:52 AM
Very Useful
Anup Patil in response to John McKee on page 9
My requirement is to select the variant "Current date + 0 , Current date + 50" in working days but when i
select the variant Date - xxx, Date + yyy(work days), it doesn't work.
Could anyone help or give any suggestion regarding this?
Thanks,
Shashank
Jimmy Dahl Pedersen
Nov 19, 2014 2:18 PM
Exactly what I needed Thank you :-)
Anup Patil in response to Poonam Chawla on page 10
Nov 8, 2014 10:48 PM
Hi Poonam,
You can simply put in date value as 'greater than or equal to 01/23/2013 (your fixed date)' in date field and I
think it should work.
So whenever you run your report/program, system will take documents from that date (01/23/2013) to current
date on which you're executing it.
Hope it helps.
Thanks.
Kind Regards,
Anup
Kashi Yadaram
Oct 9, 2014 10:55 PM
Excellent...wish I know this before.
Kashi
Poonam Chawla
Oct 9, 2014 8:28 PM
Hi,
I have a requirement for date range where the first date is fixed (01/23/2013) and last date is current date
which varies depending on sy-datum.
Which option will help me to get this resolved.is it possible with dynamic selection screen?
Kindly reply.
Mary Milliron
Sep 9, 2014 7:55 PM
Thank you. Learned something new today.
sreehari tokala
Aug 6, 2014 12:33 PM
nice document but i need Segment field where i can get his field.
Do you know how I can get the "Beginning of mth-xx-months, end of mth+yy months" option to show? That
would be perfect and exactly what I need.
Thanks.
Andrea
Thomas Zloch in response to Andrea Fuschetto on page 12
Jul 9, 2014 9:12 AM
At the bottom of the choices for dynamic date calculation, I can see
"(Beginning of mth-xx months, end of mth+yy months)"
Try this for your scenario.
Thomas
Andrea Fuschetto in response to Anup Patil on page 15
Jul 8, 2014 5:35 PM
Hello Anup:
I'm changing my Planning area in both DP and SNP from 2 years to 5 years in monthly buckets. I need to
release my forecast from DP into SNP for all buckets. In the variant, I see the choice for "Current day +/days". When I try to enter any value over 1000 days, I get an error saying it can't accept it (too long).
Good effort
keep it up
Regards,
Narayan N
Dave Thomas
Apr 15, 2014 11:35 AM
Thanks, great post. I have a report which requires a date range including a working day and a non-working
day. I need the 'date from' to be working day - 1 and the 'date to' being yesterday.
This is so that on a Monday, document postings from Friday to Sunday are picked up. Does anyone know if
this is possible via SQ02 if not in the variant?
Thanks
Thomas Zloch in response to Thanga Prakash on page 13
Mar 19, 2014 2:22 PM
But this means you want everything up to 19.03.2013. You can set "LE" (less or equal) as "option" for the
dynamic date variant "current date +/- ??? days" and that should do it.
Thomas
Thanga Prakash in response to Thomas Zloch on page 13
Mar 19, 2014 2:04 PM
If I do like that I will end up like below.
Created on 19.03.2013 TO <blank>.
My requirement is like FROM should be the initial date and TO should be current date - 365 days like.
Created on <blank> TO 19.03.2013.
Thomas Zloch in response to Thanga Prakash on page 13
Mar 19, 2014 1:50 PM
You would rather do it like "Date LE <Current date - 365 days>" using only the FROM date.
Thomas
Thanga Prakash
Mar 19, 2014 1:41 PM
How can I create a dynamic variant for date only in TO, like below.
Date <BLANK> TO <Current date - 365 days>
Sven Ringling in response to Ken Snyder on page 14
Jul 28, 2013 11:37 PM
Hi Ken,
I happened upon this post only now, but maybe it's still interesting for you:
if you need any additional variables, you can define them yourself in table TVARVC.
I the popup "choose selection variables" shown above you select T rather than D to access those variables.
However, you now need to take care of them being updated yourself. Could be manually in transaction
STVARVC or SM31, but usually you'd have a custom ABAP running in Batch every night (or whatever
frequency is needed) to update the values.
In older versions (R/3 4.5, if I remember correctly, not sure about APO), it was TVARV rather than TVARVC.
The old table was not client dependant.
Samy Magdy
Jun 26, 2013 12:33 PM
Nice one.
Pawan Kesari
Jun 21, 2013 3:08 PM
Good document.
Subrahmanyam B
Jun 21, 2013 2:36 PM
Dear,
Very informative !!
Ken Snyder
Oct 18, 2012 12:06 AM
Actually its in APO. But I am asking how to create new ones in general. What if I wanted a new dynamic
variable for end of the year. I know I can use TVARV variables. But is it possible to create new dynamic date
variables.
Jeevan Sagar in response to Ken Snyder on page 14
Oct 17, 2012 11:36 PM
What version of SAP are you on?
Ken Snyder
Oct 17, 2012 9:42 PM
How do I get all the dynamic date variables. For instance, I do not have any that say "quarter". I only have
these:
Current Date
Current date +/- ??? days
current date +/- ??? work days
First day of current month
nth working day of current month
First day of next month
First day of previous month