Easy way to validate a given DATE?
validation of date playes a major role in DATA MIGRATION in SAP.
This is the easy way to validate a given date .
This method makes use of the TYPE CONVERSION.
D to I.
Usually when we convert a variable of type d to type i,and if the value of the
variable d is a VALID date,then this conversion will give the number of days
from the initial date (00010101).
If the value of the variable d is an INVALID date,then the result of this conversion will be ZERO.
You can use this functionality of TYPES to validate a given date.
If the given date is an in valid date.
How to change the date format to user date format?
If you hard code the date format when you upload data from any file to SAP
,it will work at that point of time.But later if the user format has been changed
by someone ,your program will give you a wrong result.
Below given is a simple way to avoid this problem.
This code will convert the date format to the user format ,whatever the user