‎2008 Nov 12 6:05 AM
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
‎2008 Nov 12 6:07 AM
U should compare like this,
select ##### where BUDAT > 20060101.
‎2008 Nov 12 6:10 AM
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
‎2008 Nov 12 6:14 AM
‎2008 Nov 12 6:17 AM
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,
‎2008 Nov 12 6:18 AM
Hi,
when u r comparing dates, give date in YYYYMMDD format.
So in your case, u can write select #### where BUDAT > '20060101'.
Regards,
Devendra
‎2008 Nov 12 6:21 AM