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

date comparison

Former Member
0 Likes
795

Hello Everybody!

The problem what I'm havng is:

These information are given

keyDate 01.09.2007 type char

eventDate 20080227 type dats

The following if statement doesn' t return relyable results. With other

words this comparison is not working. How can I do it better.

IF keyDate GE eventDate.

Regards

Erdem Sas

1 ACCEPTED SOLUTION
Read only

former_member194669
Active Contributor
0 Likes
684

data : v_date(8) type c.
data : v_date1 like sy-datum.
concatenate keyDate+7(4) keyDate+0(2) keyDate+4(2) into v_date.
write v_date to v_date1.
IF v_date1 GE eventDate

4 REPLIES 4
Read only

Former Member
0 Likes
684

If you are comparing two dates, they should be of same data type(dats) and format. Then you can get better results.

Generally SAP stores dates in YYYYMMDD format.

Edited by: Naren Someneni on Mar 5, 2008 3:15 PM

Read only

Former Member
0 Likes
684

Try to have both the dates with same formats.

then you can compare them.

Read only

former_member194669
Active Contributor
0 Likes
685

data : v_date(8) type c.
data : v_date1 like sy-datum.
concatenate keyDate+7(4) keyDate+0(2) keyDate+4(2) into v_date.
write v_date to v_date1.
IF v_date1 GE eventDate

Read only

Former Member
0 Likes
684

convert event date to key date format

do like

eg:keydate:20080902

data:keydate like '20080902'.

data:eventdate

concatenate keydate6(2) '.' keydate4(2) '.' keydate+0(2) into eventdate

write:/ eventdate.

then

make comparision using if