Application Development 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: 

How to check if date is valid or not

Former Member
0 Kudos

Hi.

I have a field which contains calmonth/year (internal format yyyymm)

How do I check is the value in this field is valid or not?

Thank you,

CD

7 REPLIES 7

Former Member
0 Kudos

Hi,

You can check using the following Code.

Data : w_data(6) type c. "yyyymm

if w_date+4(2) > 12.

message 'Invalid Month' type 'E'.

endif.

Regards,

Pramod

0 Kudos

Pramod - '2008 ' (two spaces at the end) will pass your code and '2008AA' will cause it to dump.

Rob

0 Kudos

Is there any standard FM to check the validity?

0 Kudos

Well yes you are right.

I think you can try this.

if w_date4(2) is not initial and w_date4(2) > 12.

message 'Invalid Month' type 'E'.

endif.

Regards,

Pramod

0 Kudos

Found it, FUNCTION 'DATE_CHECK_PLAUSIBILITY' will work for me,,

0 Kudos

It still dumps.

Rob

0 Kudos

Look into this function module "DATE_CHECK_PLAUSIBILITY" and you may be required to append day to your input parameter.