‎2008 Feb 22 7:15 AM
Hi Guys,
I have one report to be scheduled as weekly batch job and one of the selection screen field is date range. If i set this report to run today then the date range will be from one week back date(Lower value) to today date(Higher value). When it runs for next week(Already scheduled as weekly batch job) the date range should be like this
Lower value = today date
higher value= next week run date.
How can i achieve this functionality. Is it possible through Dynamic variant concept?. Rest of the selection screen fields have some default values and should not change.
<REMOVED BY MODERATOR>
Thanks in advance,
Vinod.
Edited by: Alvaro Tejada Galindo on Feb 22, 2008 3:52 PM
‎2008 Feb 22 9:37 AM
Try using "Current date - xxx,current date + yyy" option in the Dynamic date calculation while saving the variant. I think this should solve your issue.
If that does not work, create a variable in TVARVC table and try using the same variable while saving the variant. You can update the variable with the required values during INITIALIZATION Event of your program.
Hope this helps.
Thanks
Balaji
‎2008 Feb 22 7:30 AM
Hi Vinod,
Would suggest you to this.
Create two parameters : p_start_date and p_end_date of type sy-datum on your selection screen , instead of a range.
Now goto create a variant from SE38 for the report.
While creating the variant, mark the "Selection Variable" checkbox for the two parameters and click on "Selection Variables".
Select the option "D: Dynamic date calculation" for both the date fields.
For p_start_date - select the option "Current Date"
For p_end_date - select the option "Current date +/- ??? days" and put 7 in the pop up.
Hence what you have done now is, set up a dynamic variant, where p_start_date will have sy-datum and p_end_date will have sy-datum + 7, everytime the job runs.
Now, in the program, first step after START-OF-SELECTION code the following:
RANGES: r_date FOR sy-datum.
start-of-selection.
refresh r_date.
r_date-sign = 'I'. r_date-option = 'BT'.
r_date-low = p_start_date. r_date-high = p_end_date.
append r_date.
Hence this way, you would have built your range and use it as needed.
Cheers,
Aditya
‎2008 Feb 22 7:32 AM
Ya u can do it using variant............
goto the variant,
for that select-option click the F4 help on selection variable field and select D.....click the F4 help on name of variable field and Current date +/- ??? days and do as u wish......
in SM36 while scheduling give this variant name with program...............
Cheers,
jose
‎2008 Feb 22 9:37 AM
Try using "Current date - xxx,current date + yyy" option in the Dynamic date calculation while saving the variant. I think this should solve your issue.
If that does not work, create a variable in TVARVC table and try using the same variable while saving the variant. You can update the variable with the required values during INITIALIZATION Event of your program.
Hope this helps.
Thanks
Balaji
‎2015 Jan 21 12:34 PM
data: 3mdate type datum.
call function 'RP_CALC_DATE_IN_INTERVAL'
exporting
date = sy-datum
days = '00'
months = '03'
signum = '-'
years = '00'
importing
calc_date = 3mdate.
s_budat-low = 3mdate.
s_budat-high = sy-datum.
s_budat-sign = 'I'.
s_budat-option = 'BT'.
append s_budat.