2009 Sep 15 1:21 PM
Hi All,
For a given date range in the selection screen i need to find all the dates in between that range into one internal table.
Eg: if i give the date as 21.09.2009 to 20.10.2009 then for this date range in need to get all the dates in between that date range
in one internal table.
Is there any fundtion module to fullfill such a requirement. Please do the needful help.
Thanks
Shashikanth Naram
2009 Sep 15 1:47 PM
why do you need all dates. if you need some kind of range you can use between abc and def. or you can create a range table as well.
any ways for your purpose.
DATA: dt1 type sy-datum VALUE '20090910'.
DATA: dt2 type sy-datum VALUE '20090918'.
DATA : i1 type i.
i1 = dt2 - dt1.
data : it1 type TABLE OF sy-datum WITH HEADER LINE.
do i1 TIMES.
it1 = dt2.
dt2 = dt2 - 1.
APPEND it1.
enddo.
LOOP AT it1.
WRITE 😕 it1.
ENDLOOP.
2009 Sep 15 1:29 PM
v_first_date = '21.09.2009' .
wa_date = v_first_date.
append wa_date to t_date.
while date <= '30.10.2009'
wa_date = wa_date + 1
append wa_date to t_date.
endwhile.
This should work. Good luck.
2009 Sep 15 1:40 PM
Hello Pranu,
This should work. Good luck.
You should wish him luck 'coz the code will lead him in to the trap of "infinite loop".
v_first_date = '21.09.2009' .
wa_date = v_first_date.
append wa_date to t_date.
" while date <= '30.10.2009'
while wa_date <= '30.10.2009'.
wa_date = wa_date + 1
append wa_date to t_date.
endwhile.
Cheers,
Suhas
2009 Sep 15 1:45 PM
Fortunately Typos will be caught in Syntax check so no infinite loop.
2009 Sep 15 1:47 PM
Hi Suhas,
I there any solution of finding this i.e is any standard funditon module to find this...
Thanks
Shashi
2009 Sep 15 1:52 PM
Hi
No, I don't think there's a fm to obtain it, u need to use a solution developed by yourself
Max
2009 Sep 15 1:47 PM
why do you need all dates. if you need some kind of range you can use between abc and def. or you can create a range table as well.
any ways for your purpose.
DATA: dt1 type sy-datum VALUE '20090910'.
DATA: dt2 type sy-datum VALUE '20090918'.
DATA : i1 type i.
i1 = dt2 - dt1.
data : it1 type TABLE OF sy-datum WITH HEADER LINE.
do i1 TIMES.
it1 = dt2.
dt2 = dt2 - 1.
APPEND it1.
enddo.
LOOP AT it1.
WRITE 😕 it1.
ENDLOOP.
2009 Sep 15 1:53 PM
Hi Sashi,
Just have a look at this link below.
https://wiki.sdn.sap.com/wiki/display/ABAP/FunctionModulerelatedonDate+calculations
It gives the list of all the date related FM's. Maybe something can be of help to your requirement.
Thanks,
Harini
2021 Nov 02 9:54 PM
2009 Sep 15 2:09 PM
USE THE FUNCTION MODULE
DAY_ATTRIBUTES_GET
IF IT DOESNT WORK USE
'HR_99S_INTERVAL_BETWEEN_DATES Difference ' AND INCREMENT MONTS AND YEARS
DEFINETLY YOU WILL GET OUTPUT
2024 May 28 10:43 AM - edited 2024 May 28 10:45 AM
Dear all, thanks for this query ,thanks my efforts got reduced. this FM DAY_ATTRIBUTES_GET
it resolved my purpose and does exact same, as asked in query, just give start and end date, it will give List of ALL dates between given input 2 dates .. very gratefull.