‎2007 May 18 1:18 PM
Hi all
can anybody tell logic behind below that gives the error message wrong entry if we enter year only two or three digits.
What i didnt understand here is how it finds the above wrong entry using simply year+2(1) etc.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.
PARAMETERS : p_month(2) TYPE c,
p_year(4) TYPE c.
SELECTION-SCREEN END OF BLOCK b1.
AT SELECTION-SCREEN.
IF p_year2(1) = ' ' OR p_year3(1) = ' ' OR p_year+2(2) = ' '.
MESSAGE 'Wrong entry in year field! Enter year in 4 characters .......' TYPE 'E'.
ENDIF
thanks in adv
sateesh
‎2007 May 18 1:25 PM
Hi,
Here the validation check is for all 4 digits to be filled in the year field. if only 1 or 2 or 3 digits filled, it will give an error message.
With regards,
Vamsi
‎2007 May 18 1:21 PM
In a particular date either date or month or year cant be zero.
if anyone is zero that is a wrong date.
‎2007 May 18 1:21 PM
This is called offset.
e.g. if year = 2014
Then year+2(1) means 1.
As it starts with 0.
Regards,
Amit
reward al helpful replies.
‎2007 May 18 1:23 PM
hi ,
In the code :
IF p_year2(1) = ' ' OR p_year3(1) = ' ' OR p_year+2(2) = ' '.
the logic is used to check if there is a space somethere in the in the value entered. if a space is there, then that means the number is not proper and so the year .And accordingly the error message is passed .
Hope this explains properly to you !!
Regards,
Ranjita
‎2007 May 18 1:25 PM
Hi,
Here the validation check is for all 4 digits to be filled in the year field. if only 1 or 2 or 3 digits filled, it will give an error message.
With regards,
Vamsi
‎2007 May 18 1:27 PM
This is just to validate if the length of the field p_year is 4, also try this
AT SELECTION-SCREEN.
len = strlen(p_year).
if len ne 4.
message........
endif.