2006 Jul 19 10:05 AM
Hi all,
Does anyone know if there is a function module which gives back the list of days when we give a date range as input parameter to the function module. For example, we enter the range 10.07.2006 - 13.07.2006 and the function module gives back a table in form 10.07.2006, 11.07.2006, 12.07.2006, 13.07.2006.
Thanks,
Sükrü
2006 Jul 19 10:08 AM
2006 Jul 19 10:08 AM
Hai Suekrue
Check the following Code
data: begin_date type sy-datum value '20060110',
end_date type sy-datum value '20060125'.
data: idatum type table of sy-datum with header line.
idatum = begin_date.
append idatum.
do.
if idatum = end_date.
exit.
endif.
idatum = idatum + 1.
append idatum.
enddo.
loop at idatum.
write:/ idatum.
endloop.
Regards
Sreeni
2006 Jul 19 10:11 AM
Hello,
You can do as per below:
select-options : s_datum for sy-datum.
data: l_date type d.
l_date = w_datum-low.
itab-date = l_date.
append itab.
Do.
if l_Date = s_Datum-high.
exit.
endif.
l_date = l_date + 1.
itab-date = l_date.
append itab.
clear itab.
enddo.
Regards,
Naimesh
2006 Jul 19 10:12 AM
Thanks Sreen. and Naimesh,
Your answers help a lot to solve the problem.
Regards,
Sükrü
2006 Jul 19 10:14 AM
Hi suekrue,
1. Exactly for this purpose,
i have written an
INDEPENDENT FORM (subroutine)
wherein we pass
a) fromdate
b) todate
c) ITAB
2. and it gives all the dates in the internal table.
3. just copy paste
4.
data : itab type table of sy-datum with header line.
parameters : fromdate type sy-datum default '20060701'.
parameters : todate type sy-datum default sy-datum.
perform getdays tables itab using fromdate todate.
break-point.
*----
FORM
*----
form getdays
tables itab
using fromdate todate.
data : curdate type sy-datum.
curdate = fromdate.
do.
if curdate > todate.
exit.
endif.
itab = curdate.
append itab.
curdate = curdate + 1.
enddo.
endform. "getdays
regards,
amit m.