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

Comparing Dates

Former Member
0 Likes
755

Hi folks,

I have to use a validation for date field, for one of my select queries.

I am using it as select ##### where BUDAT > 01012006.

Is this correct way...or is there any other way to do so..please help me.

Thanks,

Shyam.

Edited by: shyam prasad on Nov 12, 2008 7:06 AM

6 REPLIES 6
Read only

Former Member
0 Likes
659

U should compare like this,

select ##### where BUDAT > 20060101

.

Read only

Former Member
0 Likes
659

why don't you declare a constant (same datatype as the one u are using in select query) with value 01012006.

then write the select statement using this constant.

if u have any problem, give the table and field u want to perform select upon, someone of us can help u.

Regards,

SAPient

Read only

Mohamed_Mukhtar
Active Contributor
0 Likes
659

hi ,

[Comparing Dates|]

Thanks & Regards

Read only

rthoodi
Active Participant
0 Likes
659

Hi,

Date format should have been match with your default parameters

and from which table you are getting this date, because for dates there is no master table, so you can validate like this.

if not P_BUDAT is initial.

if P_BUDAT GT '20060101'.

message.

else.

endif.

endif,

Read only

0 Likes
659

Hi,

when u r comparing dates, give date in YYYYMMDD format.

So in your case, u can write select #### where BUDAT > '20060101'.

Regards,

Devendra

Read only

Former Member
0 Likes
659

select ##### where BUDAT > '20060101'.