2014 Jan 21 2:07 PM
I have a date field that has a start and end date in a variant.
It is defined by a select option as i.e. s_date for vbap-erdat. And shows on screen as two fields - one for start of the date range and one for the end of the date range.
My need is to have the start date automatically fill with a date 90 days prior to the current date. I do not have a problem using the 'selection variables' to create that.
But do not know how do a use the selection variables to have the end date in the range default to today's date.
I have found where someone did this can got the date range to look like this in the selection variables : "current_date - 90 , current date - 0" but I do not know how they did this.
2014 Jan 21 3:28 PM
I found the selection variable that works - no need to do anything in the program.
2014 Jan 21 2:16 PM
Hi Scott,
Write a code in Initialization event like below.
Initialization.
DATE1 = SY-DATUM - 90.
S_DATE-SIGN = 'I'.
S_DATE-OPTION = 'BT'.
S_DATE-LOW = DATE1.
S_DATE-HIGH = SY-DATUM.
APPEND S_DATE.
Arivazhagan S
2014 Jan 21 2:24 PM
Hi Scott,
Wouldn't simply to assign end date as 'current date' instead of 'current date -' work?
Regards,
Edgar
2014 Jan 21 2:26 PM
Hope I understand u
TABLES: t000.
SELECT-OPTIONS s_date FOR t000-CHANGEDATE.
INITIALIZATION.
s_date-low = sy-datum - 90.
s_date-high = sy-datum.
APPEND s_date.
If you look for it in the variant sceen.
In the parameters tables. look for columns: "Selection Variables" and select the 'D'
In column 'Name of variable" Press F4 and select 'Current date - xxx,current date + yyy'
Good Luck
2014 Jan 21 2:30 PM
What is your exact problem
Else you could use INITIALIZATION event to fill the select-options/range internal table (sign='I', option='BT' and fill low/high subfields before appending to range)
Regards,
Raymond
2014 Jan 21 3:28 PM
I found the selection variable that works - no need to do anything in the program.
2014 Jan 21 3:37 PM
Hi Scott -
Here is the code.
TABLES : vbap.
SELECT-OPTIONS : s_date FOR vbap-erdat.
INITIALIZATION.
s_date-low = sy-datum - 90.
s_date-high = sy-datum.
s_date-sign = 'I'.
s_date-option = 'BT'.
APPEND s_date.
Let us know, if it helps.
Regards,
Atul Mohanty
2014 Jan 21 5:29 PM
2014 Jan 21 6:10 PM
To set selection variables to date range where fist is minus 90 days and second is the current date:
Use the "selection variables' button and then select the 'CURRENT DATE - XXX DAYS, CURRENT DATE - YYY' format.
It will prompt you to enter values in ot XXX and YYY.
Replace XXX with 90 days (it will go back 90 days - no negative sign needed). Replace YYY with 0 and it will take current date - 0 = current date.
For example: Date From: 10/23/2013 To Date: 10/21/2014
2014 Jan 21 6:22 PM