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 check - function module

Former Member
0 Likes
1,618

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

8 REPLIES 8
Read only

Former Member
0 Likes
1,437

DATE_CHECK_PLAUSIBILITY

It checks teh date format against the system format.

Read only

Former Member
0 Likes
1,437

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

Read only

0 Likes
1,437

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

Read only

0 Likes
1,437

Hi,

Use FM: CONVERT_DATE_FORMAT to convert date into required format.

Use FM : DATE_CHECK_PLAUSIBILITY for checking the date.

check this link :

Regards

Appana

Read only

0 Likes
1,437

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

Read only

Former Member
0 Likes
1,437

Use FM <b>DATE_CHECK_PLAUSIBILITY</b>

Check this out

Regards,

santosh

Read only

Former Member
0 Likes
1,437

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

Read only

0 Likes
1,437

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