Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Read Data Based On Latest Document Change Date

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

Tags:
replied

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.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question