‎2006 Aug 25 2:08 PM
Hi all,
Can anyone tell me the fn. module to check date and send error in case of wrong format.
the format req. is MM/DD/YYYY
thanks,
bharat
‎2006 Aug 25 2:15 PM
DATE_CHECK_PLAUSIBILITY
It checks teh date format against the system format.
‎2006 Aug 25 2:18 PM
HI
GOOD
DATE_CHECK_PLAUSIBILITY Check to see if a date is in a valid format for SAP. Works well when validating dates being passed in from other systems.
DATE_COMPUTE_DAY Returns a number indicating what day of the week the date falls on. Monday is returned as a 1, Tuesday as 2, etc.
DATE_IN_FUTURE Calculate a date N days in the future.
thanks
mrutyun
‎2006 Aug 25 2:22 PM
Hi Tripathy & Ravi,
I want to know if there is a generic one, i.e I want to have check against the format I specified.
Thanks,
Bharat
Message was edited by: Bharat
‎2006 Aug 25 2:30 PM
‎2006 Aug 25 2:31 PM
Hello,
Convert your date to the generic format and use the fm DATE_CHECK_PLAUSIBILITY.
l_date0(4) = your_date6(4).
l_date4(2) = your_date3(2).
l_date6(2) = your_date0(2).
Regards,
Naimesh
‎2006 Aug 25 2:33 PM
‎2006 Aug 25 2:44 PM
YOu have to cook your pwn logic in this way:
lets say you have your date in the variable date.
replace all occurances of '/' in date with ''.
if not date co '0123456789 '.
raise invalid_date.
endif.
if date+0(2) > 12.
raise invalid_date.
endif.
if date+2(2) > 31.
raise invalid_date.
endif.
year = date+4(4).
have some logic to find a leap year and set leap = 'X'
if leap = 'X'.
else.
if date0(2) = '02' and date2(2) > 28.
raise invalid_date.
endif.
endif.
if ( date+0(2) = '04' or
date+0(2) = '06' or
date+0(2) = '09' or
date0(2) = '11' ) and date2(2) > 30.
raise invalid_date.
endif.
if ( date+0(2) = '01' or
date+0(2) = '03' or
date+0(2) = '05' or
date+0(2) = '07' or
date+0(2) = '08' or
date+0(2) = '10' or
date0(2) = '12' or ) and date2(2) > 31.
raise invalid_date.
endif.
if date+4(4) > '9999'.
raise invalid_date.
endif.
Regards,
ravi
‎2006 Aug 25 3:00 PM
Hi Ravi,
First of all thanks for the reply.I was looking into the above FMS to do my own stuff.
well,the other point is I am having a conversion exit in system.
I will check and let u know.
Thanks,
Bharat