Application Development and Automation 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: 
Read only

Regarding Date

Former Member
0 Likes
793

hi all,

How can we find maximum date among given dates.

Please suggest.

Regards

Reddy

7 REPLIES 7
Read only

JozsefSzikszai
Active Contributor
0 Likes
775

hi,

depends on the data source: for example if the dates are in an internal table, than you can sort the internal table by date descending and the date in the first line will be the highest.

hope this helps

ec

Read only

naveen_inuganti2
Active Contributor
0 Likes
775

Hi....

You can easily trace this by using IF conditon with GT ( > ) sign.

---naveen.I

Read only

Former Member
0 Likes
775

Hi,

put the date in an internal table, sort table DESCENDING, and read the first entry.

Regards, Dieter

Read only

Former Member
0 Likes
775

sort by descending order

read table with index 1.

Read only

Former Member
0 Likes
775

hi ram redddy .,

if it is from DB table USe MAX(DATE) .

if it is from internal table just Sort table by date descending .

read table itab with key index = 1 .

thanks

Sreenivas Reddy

Read only

Former Member
0 Likes
775

Hi ramireddy,

If your data is in internal table then sort that internal table descending by date. Now you can easily get the maximun date.

Regards,

Rajitha.

Read only

naveen_inuganti2
Active Contributor
0 Likes
775

Hi.....

Check this code...

Do like this if those dates in variables...

or half this code.... if those dates in internal tables....

data: date1 like sy-datum,
      date2 like sy-datum,
      date3 like sy-datum,
      date4 like sy-datum,
      date5 like sy-datum.

date1 = sy-datum.
date2 = sy-datum - 1.
date3 = sy-datum - 4.
date4 = sy-datum + 10.
date5 = sy-datum + 1.

data: begin of itab occurs 0,
      date like sy-datum,
      end of itab.

itab-date = date1.
append itab.
clear itab.
itab-date = date2.
append itab.
clear itab.
itab-date = date3.
append itab.
clear itab.
itab-date = date4.
append itab.
clear itab.
itab-date = date5.
append itab.
clear itab.

sort itab descending.             <----start from here if your dates in internal tables.

read table itab index 1.

if sy-subrc = 0.
  write:/ itab-date.
endif.

Thanks,

Naveen.I