2006 Dec 17 8:44 AM
Hello All,
In an abap query there is a date field in the selection screen with from & to values.
I am trying to create a dynamic variant that will fill the following data into those fields:
From date: will be left blank
To date: will show today's date - 90 days
For example, if today's date is 01/12/2006 the variant should fill the following data into the fields:
From date: <blank>
To date: 01/09/2006
I have tried all the methods I know with dynamic dates calculation in the variant definition but did not manage to create such variant.
Any help will be very appreciated and points would be rewarded generously !
Thank you very much,
Ronen
2006 Dec 17 8:50 AM
hi,
u can use this FM.
data: wa_date like sy-datum,
wa_date_new like sy-datum.
wa_date = sy-datum.
call function 'RP_CALC_DATE_IN_INTERVAL'
exportingdate = wa_date
days = 90
months = 0
signum = '-'
years = 0
importing
calc_date = wa_date_new .now
wa_date_newwill contain the 90 days back date.
rgds
Anver
Hello All,
In an abap query there is a date field in the selection screen with from & to values.
I am trying to create a dynamic variant that will fill the following data into those fields:
From date: will be left blank
To date: will show today's date - 90 days
For example, if today's date is 01/12/2006 the variant should fill the following data into the fields:
From date: <blank>
To date: 01/09/2006
I have tried all the methods I know with dynamic dates calculation in the variant definition but did not manage to create such variant.
Any help will be very appreciated and points would be rewarded generously !
Thank you very much,
Ronen
2006 Dec 17 8:50 AM
hi,
u can use this FM.
data: wa_date like sy-datum,
wa_date_new like sy-datum.
wa_date = sy-datum.
call function 'RP_CALC_DATE_IN_INTERVAL'
exportingdate = wa_date
days = 90
months = 0
signum = '-'
years = 0
importing
calc_date = wa_date_new .now
wa_date_newwill contain the 90 days back date.
rgds
Anver
2006 Dec 17 8:54 AM
Did you choose the dynamic selection while saving the variant. There for a date field you will find different options, right? Were you not able to find current date - 90 days.
IF you see the screen shot provided in the link here, you can find the Current date +/- xxx days. That should be useful for you.
http://help.sap.com/saphelp_nw2004s/helpdata/en/c0/98039be58611d194cc00a0c94260a5/content.htm
Regards,
Ravi
Note - Please mark all the helpful answers
2006 Dec 17 11:13 AM
Thanks for the answers, but it still did not solve the problem. I am using the dynamic date calculation but can not fill the values as desired: the <b>from date</b> field should be blank and the <b>to date</b> field should show the current date - 90 days
Thanks for any help
Ronen
2006 Dec 17 11:31 AM
Ah !! Ronen,
The from value always have to be lower than the to value. So, that looks the issue in this case. How can be the from date be blank and the To date have a value, we are talking about SELECT - OPTIONS here right?
So, when you are specifying a range how can you specify only the upper limit and not specify the lower limit. So, shouldn't be Current Date to Current Date - 90 or in fact it should be Current Date - 90 to Current Date.
Regards,
Ravi
2007 Apr 17 6:43 PM
Does anybody have a response for how this date selection can be done? I also need the same date selection in my variant. I need to pick up where the date field is blank or is today3. I have tried to save multiple date selections, but to use the Dynamic date calculation for today3, I have been unsuccessful. Just looking to see if there is any way to do this date selection.
Thanks,
Anna
2010 Jun 30 6:32 PM
If the "from" date is meant to be left blank (beginning of time) and the "to" date is some date plus or minus number of days from today, you use the "current +/- days" dynamic date calculation format as was mentioned earlier. Likewise if the "from" date is some date plus or minus today's date, and the "to" date is infinity -- you only need the one Dynamic Date calculation.
To do this, first don't think about this as a date range, think of your Dynamic Date calculation as if this were a single parameter and not a select-option. You are really saying "my date is anything LT/LE this date" or "my date is anything GT/GE this date" -- not a range
In the Save Variant screen, find the desired date select-option and:
1. Choose in column "Selection Variable", a "D" (Dynamic date calculation)
2. Use F4 in the "Name of Variable" column
3. Find "Current date +/- ??? days" or "Current date +/- ??? work days" in the popup, as appropriate
4. For "I/E" (include/exclude) column select as appropriate
5. For "Option" column, choose "LE", "LT", "GE", "GT", "NE" as appropriate
6. After clicking green check mark, enter your plus or minus days (and factory calendar if using work days).
7. Finish saving your variant.
8. You may not see your changes in your variant until you back all the way out of the variant and then redisplay it. You'll see a greyed out date along with the symbol matching your choice (LT, LE, etc.)
Unfortunately if you don't have infinity on either end of the date you are limited to 999 days differences as far as I am aware. If that is the case you can populate TVARVC table with parameter or selection variables, maintain them with STVARV transaction by hand, or use an ABAP program in batch to regularly calculate the values. Then you can reference the TVARVC values in your variant instead of the Dynamic Date calculation.
If someone knows a way to bypass the use of TVARVC for date ranges that are more than 999 days apart please let me know. TVARVC works well but it is extra effort whereas Dynamic Date calculation would be much easier to maintain if the date range could be made larger than 999 days.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |