2007 May 22 4:20 AM
hi,
i want to retreive the next available date from one internal table based on input from another internal table.
itab1
02/02/2001
itab2
02/04/2006
02/03/2002
02/05/2002
now for the value in itab1(02/02/2001) i must look up itab2 and get the date closest to the date in itab1, which in this case is 02/03/2002.
has anyone worked on such calculations before.
2007 May 22 4:38 AM
Loop at itab1.
loop at itab2 where date GT itab1-date.
itab3-date = itab2.date.
append itab3.
endloop.
endloop.
Sort itab3.
read itab3 index 1.
Reward points to all useful answers.
Regards,
SaiRam
Loop at itab1.
loop at itab2 where date GT itab1-date.
itab3-date = itab2.date.
append itab3.
endloop.
endloop.
Sort itab3.
read itab3 index 1.
Reward points to all useful answers.
Regards,
SaiRam
2007 May 22 4:38 AM
Loop at itab1.
loop at itab2 where date GT itab1-date.
itab3-date = itab2.date.
append itab3.
endloop.
endloop.
Sort itab3.
read itab3 index 1.
Reward points to all useful answers.
Regards,
SaiRam
2007 May 22 4:39 AM
sort itab2 by date ascending
loop at itab1 into wa1
loop at itab2 into wa2 where wa2-date > wa1-date.
write wa2-date " this date is the closet date.
break .
endloop.
endloop.
2007 May 22 4:49 AM
hi
you can try to implement the below mentioned logic.
loop at itab1.
loop at itab2.
call function /SDF/CMO_DATETIME_DIFFERENCE.
this function can calculate the difference between two dates and than you can store that difference between the datesand ITAB2-date in local variables.When you will be looping again in itab2.compare the difference with earlier result and than if the old one is less than hold the first dateand difference in the local variables else can replace the values of with the second date and difference in the local variable.
Reward if helpful
Thanks
Mohit
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |