Calculate the days in the year
My requirement is, If U select the date counting the days in the year.
which FM is used the calulate the days in the year (365 days)
example: if I will execute 2 feb 2008 I want display 033
because in January month 31 days are there and adding the february month 2 days it will be totally 33 days in the year.
if I Execute 15 march 2008
it will be display 075 = 31(January)29(february)15(march)
vikram shah replied
you can directly write this logic in your code itself.
check the following code.
DATA: dt1 TYPE sy-datum, dt2 TYPE sy-datum, count TYPE i. dt2 = '20070303'. CONCATENATE dt2(4) '0101' INTO dt1. count = dt2 - dt1 + 1. "count must be of type integer WRITE count.
try using different years (leap and non leap). "count" variable will give you the correct result for all cases.