Skip to Content
0
Former Member
Sep 07, 2007 at 03:04 AM

counting days between dates

44 Views

hi friends, i need to calculate the days lapsed between, when the idoc was created and when it showed error.

so i thought, i need to extract date1 from a table edids when status =50 (ie. idoc created ),

and then date2 should be picked up as soon as the status of this idoc becomes 51 ( ie. error idoc).

for this i thought of doing like below:

data: date1 type sy-datum,

date2 type sy-datum.

select * from edids into table int_edids

where docnum = t_edidc-docnum

and order by countr.

loop at int_edids.

if t_edidc-status = 50.

date1= int_edids-credat.

endif.

if t_edidc-status = 51.

date2 = int_edids-credat.

exit.

endif.

endloop.

lapsed_days = date1 - date2.

will this statement work.

is there a better way of doing this ?

can some one help me with this ?