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

validity

Former Member
0 Likes
804

Hi!

How can I ensure that a date format has

valid format ? A field is populated with

any date. The format is what the user has

been set in his profile. For me now it is

now interesting to ensure that this value

is a valid date format.

regards

ilhan

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
786

hi,

then use the below statement give the format as that of BDC format


Write v_date to w_date dd/mm/yy.
or
Write v_date to w_date dd.mm.yy.
  

7 REPLIES 7
Read only

Former Member
0 Likes
787

hi,

then use the below statement give the format as that of BDC format


Write v_date to w_date dd/mm/yy.
or
Write v_date to w_date dd.mm.yy.
  

Read only

rodrigo_paisante3
Active Contributor
0 Likes
786

Hi,

if you are using select options or a parameter to get the data, then it will validate automaticaly, when you declared for/type sy-datum.

To do it with a char variable, try to declare another type date variable and try to move the value to it.

Regards.

Read only

Former Member
0 Likes
786

HI

IS THERE REALLY NO FM AVAILABLE.

IMAGINE I MUST CHECK THIS IF IT IS

VALID IN ORDER TO CALL ANOTHER

FM. IT CAN HAPPEN THAT THIS VALUE

NOT ABLE TO BEEING USED IF IT HASN'T

A ALLOWED DATE FORMAT. GENERALLY

HOW DO YOU SOLVE SUCH PROBLEMS

REGARDS

ILHAN

Read only

Former Member
0 Likes
786

hi ,

if you r declaring the field like this ..

data: date type sy-datum. or

data: data like pa0041-dat01.

then it automatically check the values ...no need to check...

but if is a char type then u need to test it ..

regards,

venkat.

Read only

Former Member
0 Likes
786

HI ALL YES IT IS

CHAR TYPE AND MY QUESTION HOW CAN IT BE

CHECKED IT THAT CASE. WHICH CHECK

MECHANISM DO YOU KNOW ???

REGARDS

ILHAN

Read only

0 Likes
786

check with sy-datum u will get to know

p_date eq sy-datum.

Read only

0 Likes
786

Ok, try to do this:

write char_data to d_data.

d_data = d_data - 1.

if d_data is INITIAL.

*Invalid date

endif.

If your char date was invalid, when you decrease by 1, it will be initial. Then you can check it!

Regards.