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

vALIDATING DATE FORMAT

Former Member
0 Likes
406

Hi,

I want to display a error message,if the date is not entered by the user is not in mm/dd/yyyy format.

Please suggest me the function module name.

Thanks in advance

2 REPLIES 2
Read only

Former Member
0 Likes
390

Hi,

Use the followin fn module, it will not accept dd/mm/yyyy format. But if you give date it will change it to dd/mm/yyyy format. SO use this, pass the date, if sy-subrc ne 0, then user has given DD/MM/YYYY format .

HRGPBS_HESA_DATE_FORMAT

Rewards points if helpful.

Regards,

CS

Read only

Former Member
0 Likes
390

Hi,

Use DATE_GET_WEEK FM.

It takes a date and should return a week. If FM returns error it would mean that a date is invalid.

EX:

CALL FUNCTION 'DATE_GET_WEEK'

EXPORTING

date = sy-datum

IMPORTING

week = ws_curr_week

EXCEPTIONS

date_invalid = 1

OTHERS = 2.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.