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

How to Validate the date

Former Member
0 Likes
960

Hi,

I am uploading the excel file but in excel file i have date field.

if end user give the date format is YYYYMMDD.

No error.

Else.

Need to display the Error ''please give the date format must be YYYYMMDD".

endif.

Can you please help me the same.

Thanks & Regards,

Ram.

6 REPLIES 6
Read only

Former Member
0 Likes
795

Hi,

1. You cannot assume different date format each time uploading the excel.

2. The date coming into sap from excel should be in one particular format.

3.Then we can assume that format and validate for correct or not.

4.You need to ask the end user as to what date format they are going to provide in the input excel file.

Reward if helpful,

Jagadish

Read only

Former Member
0 Likes
795

Hi rams b

U cannot assume different date format each time uploading the excel. The date coming into sap from excel should be in one particular format. Then we can assume that format and validate for correct or not. U need to ask the end user as to what date format they are going to provide in the input excel file.

Thanks

Venkat

Read only

0 Likes
795

Hi,

End user will be provide the date format is YYYYMMDD in Excel file.

in case user given the wrong format i have to raise the exception "Please provode the date format must be YYYYMMDD".

Regards,

Ram.

Read only

prasanth_kasturi
Active Contributor
0 Likes
795

hi,

you cannot validate while entering into the internal table,

you can do validations only at screen level

do validations in your modulepool program

regards

prasanth

Read only

Former Member
0 Likes
795

Hi

Check this FM CALL FUNCTION 'DATE_CHECK_PLAUSIBILITY'

EXPORTING

date = l_f_datum

EXCEPTIONS

plausibility_check_failed = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE e002(0s) WITH p_datum.

ENDIF.

If u can use this.

Thanks

Praveen

Read only

Former Member
0 Likes
795

Hi Rams,

This is the validation for date.

data : date1 type date.

v_day = v_invdat+6(2).

v_month = v_invdat+4(2).

v_year = v_invdat+0(4).

concatenate v_day v_month v_year into date1

SEPARATED BY '.'.

Useally we are using like this format.

you can change the format as u like using above example.

If useful plz give reward.

Thanks ,

Narasinmha