08-23-2007 7:16 PM
hallow
i had to find how much month and year i have btween dates
in month and i have to append it to my table.
i give ex.
if begda = 01.01.2005
end endda = 01.06.2007
i wont to append to period_tbl
01012007
01022007
01032007
.....
until 01.06.2007
i try with that and it working when dats less then one year but i have problem when i choose dates that more then one year like in example.
<b>i reward kindly</b>
Regards
CALL FUNCTION 'HR_AUPBS_MONTH_DAY'
EXPORTING
beg_da = p_begda
end_da = p_endda
IMPORTING
no_day = l_day
no_month = l_month
no_year = l_year.
period_tbl-period = p_begda(6).
APPEND period_tbl.
MOVE p_begda(6) TO month_tmp.
DO l_month TIMES.
period_tbl-period = month_tmp + sy-index.
APPEND period_tbl.
ENDDO.
08-23-2007 7:23 PM
data : lv_sdate type sy-datum,
lv_edate type sy-datum.
data begin of itab occurs 0,
period(8),
end of itab.
while lv_sdate <= lv_edate.
itab-period+0(2) = '01'.
itab-period2(2) = lv_sdate4(2).
itab-period4(4) = lv_sdate0(4).
append itab.
lv_sdate4(2) = lv_sdate4(2) + 1.
endwhile.
08-23-2007 7:23 PM
data : lv_sdate type sy-datum,
lv_edate type sy-datum.
data begin of itab occurs 0,
period(8),
end of itab.
while lv_sdate <= lv_edate.
itab-period+0(2) = '01'.
itab-period2(2) = lv_sdate4(2).
itab-period4(4) = lv_sdate0(4).
append itab.
lv_sdate4(2) = lv_sdate4(2) + 1.
endwhile.
08-23-2007 7:29 PM
hi manesh
thankes for your answer.
maybe u can explain your code
Best regards
08-23-2007 7:34 PM
data : lv_sdate type sy-datum,
lv_edate type sy-datum.
data begin of itab occurs 0,
period(8),
end of itab.
lv_sdate = '20050101'. " Start date
lv_edate = '20070101'. "Enddate
while lv_sdate <= lv_edate. " while start date is less than equal to end date
itab-period+0(2) = '01'. " day is 01
itab-period2(2) = lv_sdate4(2). " month is the month value which is 5th and 6th character in the date
itab-period4(4) = lv_sdate0(4). " year is the frist 4 charactterd of the field.
append itab.
lv_sdate4(2) = lv_sdate4(2) + 1. increase the month by one...
endwhile.
Hope this helps..
08-23-2007 7:37 PM
08-23-2007 7:27 PM