Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to Check the date and get the latest date?

Former Member
0 Kudos

Hi Everyone,

I've an internal table which holding few records which contain date field. How I can check this internal table by getting the record which contain "latest date" only? Kindly advise. Thank you.

eg:

I should only get the record which contain lastest date. (eg: I should picked up Record3)

Table i_test

Field 1 Field 2(date)

Record1 20090322

Record2 20090101

Record3 20090601

Moderator message - Please search before asking and do not ask basic questions - post locked

Edited by: Rob Burbank on Jun 17, 2009 9:21 AM

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,

Sort the internal table by date in descending order and read the date in the first record of the internal table.

You will get the latest date.

Thanks,

Rakesh

2 REPLIES 2

Former Member
0 Kudos

Hi,

Sort the internal table by date in descending order and read the date in the first record of the internal table.

You will get the latest date.

Thanks,

Rakesh

former_member212005
Active Contributor
0 Kudos

Its easy...sort the internal table using the field i.e. date field in DESCENDING manner

SORT gt_final BY date_field DESCENDING.

Read the first entry of the internal table..it will have what you require

READ gt_final INDEX 1.