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: 

compare two dates

Former Member
0 Kudos

hi gurus,

i have an internal table with 10 records.

one of the columns is 'Modification Date' ,

i need to get the latest of the records, ie. the date which is most recent.

how do i acomplish this task,

is there a function module to compare dates in an internal table.

thanks.

1 ACCEPTED SOLUTION

former_member156446
Active Contributor
0 Kudos

you can use sort based on date and as well as compare as well

sort table itab1 by dat1 descending.

sort table itab2 by dat2 descending.

if itab1-dat1 > itab2-dat2.

....

..

4 REPLIES 4

former_member156446
Active Contributor
0 Kudos

you can use sort based on date and as well as compare as well

sort table itab1 by dat1 descending.

sort table itab2 by dat2 descending.

if itab1-dat1 > itab2-dat2.

....

..

0 Kudos

Sort the internal table by date descending and pick the first record.

Former Member
0 Kudos

Hello Sanjana-

To get the latest record comparing date field for ex:budat.

sort i_tab by budat ascending.

read table i_tab into w_area index 1.

Cheers,

~Srini.....

Former Member
0 Kudos

Hello Sanjana-

To get the latest record comparing date field for ex:budat.

sort i_tab by budat ascending.

read table i_tab into w_area index 1.

Cheers,

~Srini.....