‎2009 Jun 22 5:52 PM
I need to write code for date field validation.
Condition:
1. Check If date field contains alphabet A to Z.
If yes - don't fail the load but capture in PSA with returncode 1.
2. Check if date field is blank/ empty.
If yes, load should continue and date field can be empty which is acceptable.
3. Check if the date field is 10 characters long.
If yes - do all the varification for day, month & year.
4. If length is less than 10, don't fail the load but capture in PSA with returncode 1.
Could you please help me how to put all this condition togather in code?
Thanks,
Moderator message - Please ask a specific question, but don't ask the forum to do your work for you. Try coding this yourself and if you have specific questions, then come back to the forum with them. - post locked
Edited by: Rob Burbank on Jun 22, 2009 1:14 PM
‎2009 Jun 22 6:02 PM
>
> 1. Check If date field contains alphabet A to Z.
> If yes - don't fail the load but capture in PSA with returncode 1.
>>if you declare it as type D or sy-datum it will not accept characters
> 2. Check if date field is blank/ empty.
> If yes, load should continue and date field can be empty which is acceptable.
>> if lv_date is initial.
> 3. Check if the date field is 10 characters long.
> If yes - do all the verification for day, month & year.
>>move the date to character format and check the screen length and check if its 10 or less
> 4. If length is less than 10, don't fail the load but capture in PSA with returncode 1.
>> raise exception 1
>