09-18-2008 2:55 AM
Dear all,
I would like to pull data based on latest date and print it out.
Now I having 2 internal table:
itab1 having info record no, vendor, material, and value
itab2 having info record no and info record change date
both info record no. came from different field.
How can I get the latest date in itab2 and pull out the data from itab1 based on the date? Can you please give me a sample code?
I know to get latest date is sort itab2 descending and read itab2 index 1, but how should I pull data from itab1 based on this?
Rewards point will be given for helpful answer. Thank you
09-18-2008 5:39 AM
Hello
sort itab1. sort itab2.
loop at itab2.
at end of 'info record no'.
read table itab1 with key 'info record no' = itab2-'info record no'.
if sy-subrc = 0.
write: itab1-'info record no',
itab1-'vendor',
itab1-'material',
itab1-'value'.
endif.
endat.
endloop.
09-18-2008 5:39 AM
Hello
sort itab1. sort itab2.
loop at itab2.
at end of 'info record no'.
read table itab1 with key 'info record no' = itab2-'info record no'.
if sy-subrc = 0.
write: itab1-'info record no',
itab1-'vendor',
itab1-'material',
itab1-'value'.
endif.
endat.
endloop.
09-18-2008 5:55 AM
Hi,
SORT itab1.
SORT itab2.
LOOP at itab1 into wa_itab1.
read table itab2 WITH KEY
'info record no' = wa_itab1'infozecord no'.
if sy-subrc = 0.
write : / itab2-'info record change date'.
endif.
ENDLOOP.
regards,
Bhupal.