‎2008 May 01 2:08 PM
Hi guys,
I have to transfer a file in a transaction. The file contains Dates but one of the date is wrong. The date is like this 45.03.2007. How should we validate this date? I do not want to transfer this record from flat file to the transaction.
Thanks
‎2008 May 01 2:44 PM
I'm assuming that your date field is formatted the way you want but the data is incorrect.
There are a number of things you could do. The easiest is to perform a subtring check on the field - check to make sure the DAY digits are between 1 and 31, the MONTH digits between 1 and 12 etc.. This won't always work b/c months have differing # of days.
The next thing you could do is find a FM that calculates something based on an input date - for example, find one that gets the Day of the Week based on date. If the FM fails, you most likely have a bad input date.
I'm sure there are many FMs available - go to SE37 and search for checkdate* or getdate* or something like that.
Lastly, you can always debug a date field validation in SAP to see how they do it.
‎2008 May 01 2:46 PM
‎2008 May 01 2:47 PM
Try this FM:
CONVERT_DATE_TO_INTERNAL
Enter your date, how it is coming in the flat file.
If the date is invalid, FM gives the exception, DATE_EXTERNAL_IS_INVALID.
Regards,
Naimesh Patel