‎2007 Oct 04 10:53 PM
I need to find out the files from the internal table which are in the given date range.
for example Files will be in the following format,
<b> fielname_YYYYMMDD</b>
here <b>yyyymmdd</b> is the date. If the date range is 20071002 to 20071004 then i need to fetch 3 files from the internal table. the files are
<b>filename_20071002
filename_20071003
filename_20071004</b>
can someone help me how to do this in an efficient way.
Regards,
Amal
‎2007 Oct 04 11:30 PM
Hi,
Please try this.
data: l_datum like sy-datum,
l_date1 like sy-datum,
l_date2 like sy-datum.
l_date1 = '20071002'.
l_date2 = '20071004'.
loop at itab.
clear l_datum.
l_datum = itab-file+9(8).
if l_datum between l_date1 and l_date2.
move itab-file to itab2-file.
append itab2.
endif.
endloop.
Regards,
Ferry Lianto
‎2007 Oct 04 11:29 PM
Hi,
Let's assume if you have v_date_low and v_date_high
* Create a new intenral table to have the dates.
DATA: t_date type standard table of sydatum.
data: s_date type sydatum.
DO.
if sy-index = 1.
s_date = v_date_low.
append s_date to t_date.
continue.
endif.
v_date_low = v_date_ low + 1. " Increment the date low
s_date = v_date_low.
append s_date to t_date.
* Exit condition.
if v_date_low = v_date_high.
exit.
endif.
ENDDO.
***Now you have all the dates in the intenral table T_DATE.
LOOP AT t_date into s_date.
* concatenate to get the filename.
CONCATENATE 'FILENAME' s_date INTO v_filename.
* Call the function module RZL_READ_DIR_LOCAL with the variable v_filename
* to get the file contents.
ENDLOOP.
Thanks
Naren
‎2007 Oct 04 11:30 PM
Hi,
Please try this.
data: l_datum like sy-datum,
l_date1 like sy-datum,
l_date2 like sy-datum.
l_date1 = '20071002'.
l_date2 = '20071004'.
loop at itab.
clear l_datum.
l_datum = itab-file+9(8).
if l_datum between l_date1 and l_date2.
move itab-file to itab2-file.
append itab2.
endif.
endloop.
Regards,
Ferry Lianto
‎2007 Oct 08 10:45 PM