2007 Jan 24 5:33 AM
Good morning,
I'd like to display the date the particular material was counted on..... in case I have 2 count dates for the single material I should display the recent one. please help.
2007 Jan 24 5:40 AM
suppose your itab contains
matnr date like this.[sequence is important here]
sort itab by matnr date descending.
loop at itab int watab.
at new matnr.
write : / watab-matnr, watab-date.
endat.
endloop.
regards
shiba dutta
Good morning,
I'd like to display the date the particular material was counted on..... in case I have 2 count dates for the single material I should display the recent one. please help.
2007 Jan 24 5:35 AM
Hi,
I think you can Sort the data by date and read the first record. This will be easy if you have the data in internal table else sort in the qury itself.
Regards,
Sesh
2007 Jan 24 5:37 AM
2007 Jan 24 5:39 AM
Hi ,
I if all the data is in internal table then sort the internal table by material numer and date descending.
So it would be SORT IT BY MATNR DATE DESCENDING.
So it sorts the material number and if a material has more than 1 date then the records will be arranged in descending order of date.
the you can use delete adjacent duplicates comparing matnr to delete all duplicte reords.
Regards
Arun
2007 Jan 24 5:36 AM
You can compate the date using if condition.
if date1 > date2.
write:/ date1. "Recent date
endif.
2007 Jan 24 5:39 AM
2007 Jan 24 5:36 AM
Hi
In that case when you have two dates consider the time factor also .
Sort your table by date descending time descending.
Try this .
Please reward if useful.
2007 Jan 24 5:40 AM
suppose your itab contains
matnr date like this.[sequence is important here]
sort itab by matnr date descending.
loop at itab int watab.
at new matnr.
write : / watab-matnr, watab-date.
endat.
endloop.
regards
shiba dutta
2007 Jan 24 5:43 AM
sort itab1 by matnr ascending date1 by descending.
loop at itab1 into wa_itab1.
read table itab1 with key matnr = wa_itab1 binary search.
if sy-subrc = 0.
g_date = itab1-date1.
endif.
endloop.
2007 Jan 24 5:43 AM
sort itab1 by matnr ascending date1 by descending.
loop at itab1 into wa_itab1.
read table itab1 with key matnr = wa_itab1 binary search.
if sy-subrc = 0.
g_date = itab1-date1.
endif.
endloop.
2007 Jan 24 6:48 AM