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

A function module for validating date

Former Member
0 Likes
8,617

Hi,

Can you give me a function module for validation of date.

For example if the date is given as 31st of Feb it shoud give me an error message.

Thanks in advance.

-Reni

1 ACCEPTED SOLUTION
Read only

Former Member
3,162

chk this

REPORT YCHATEST.

data : dat like sy-datum value '20060231'.

CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
  EXPORTING
    DATE                            = dat.

It will give status message at the bottom

Message was edited by: Chandrasekhar Jagarlamudi

4 REPLIES 4
Read only

Former Member
3,162

hi Reni,

Check this FM <b>DATE_CHECK_PLAUSIBILITY</b> to validate the date

Have a look at this thread

Regards,

santosh

Read only

Former Member
0 Likes
3,162

Hi Reni,

Use Function module <b>DATE_CHECK_PLAUSIBILITY</b> to validate a date.

1)If you given a invalidate date then it will ask you to enter a valid date.

2)After changing it to correct value, you can click on SAVE button or if you want to continue with the invalid date then click on USE INVALID VALUE button.

Try with this code.

PARAMETER P_DATE TYPE SYDATUM.

CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'

EXPORTING

date = P_DATE

EXCEPTIONS

PLAUSIBILITY_CHECK_FAILED = 1

OTHERS = 2.

<b>IF sy-subrc <> 0.

MESSAGE E000(ZI) WITH 'INPUT DATE IS INVALID DATE'.

ENDIF.</b>

Thanks,

Vinay

Read only

Former Member
0 Likes
3,162

Hi,

Check the FM's <b>CONVERT_DATE_INPUT

DATE_CHECK_PLAUSIBILITY</b>

Regards

vijay

Read only

Former Member
3,163

chk this

REPORT YCHATEST.

data : dat like sy-datum value '20060231'.

CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'
  EXPORTING
    DATE                            = dat.

It will give status message at the bottom

Message was edited by: Chandrasekhar Jagarlamudi