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

doubt in selection screen -reg

Former Member
0 Likes
558

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

1 ACCEPTED SOLUTION
Read only

former_member219399
Active Participant
0 Likes
540

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

5 REPLIES 5
Read only

Former Member
0 Likes
540

In a particular date either date or month or year cant be zero.

if anyone is zero that is a wrong date.

Read only

amit_khare
Active Contributor
0 Likes
540

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.

Read only

former_member196299
Active Contributor
0 Likes
540

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

Read only

former_member219399
Active Participant
0 Likes
541

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

Read only

Former Member
0 Likes
540

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.