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

validation for month

Former Member
0 Likes
2,090

Hi

I have a field spmon on the selection screen in which date format is mm.yyyy.

the range of dates can vary from month april to august ie. 04.yyyy to 08.yyyy.

How can i validate these dates. can anyone help me pls.

thanks

bye

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,308

Hi,

SELECT-OPTIONS: s_date FOR xxxx.

AT SELECTION-SCREEN ON s_date.
 IF NOT s_date[] IS INITIAL.
  IF  s_date-low+0(2) LE '04'
 OR s_date-high+0(2) GE '08'.
 message e000 with 'ENter date range from April to August'.
 ENDIF.
 IF s_date-low+2(4) > s_date-high+2(4).
 message e000 with 'Enter year correctly'.
 ENDIF.
 ENDIF.

Message was edited by:

Judith Jessie Selvi

7 REPLIES 7
Read only

Former Member
0 Likes
1,308
at selection-screen.

if not s_month[] is initial.

  loop at s_month.
   if not ( s_month-low+0(2) GE 04 and s_month-high+(2) LE 08 ).
      * error message
  endloop.

endif.

Message was edited by:

Chandrasekhar Jagarlamudi

Read only

0 Likes
1,308

thank u sir for the reply

really it helped me a lot

thanks

Read only

Former Member
0 Likes
1,308

hi,

do this way..

at selection-screen.
if spmon-low+0(2) < '04' and
   spmon-low+0(2) > '08'.
<error>
endif.    

Regards,

Santosh

Read only

0 Likes
1,308

hi santosh

thanks for reply.thanks a lot

Read only

Former Member
0 Likes
1,308

Hi,

I feel there is no need to validate these date fields if at all you declared these fields like S021-SPMON. Because it itself validating the month. If you enter values other than 01 to 12 it is just vanishing and not consider the other values.

Just check.

Regards,

Anji

Message was edited by:

Anji Reddy Vangala

Read only

Former Member
0 Likes
1,309

Hi,

SELECT-OPTIONS: s_date FOR xxxx.

AT SELECTION-SCREEN ON s_date.
 IF NOT s_date[] IS INITIAL.
  IF  s_date-low+0(2) LE '04'
 OR s_date-high+0(2) GE '08'.
 message e000 with 'ENter date range from April to August'.
 ENDIF.
 IF s_date-low+2(4) > s_date-high+2(4).
 message e000 with 'Enter year correctly'.
 ENDIF.
 ENDIF.

Message was edited by:

Judith Jessie Selvi

Read only

0 Likes
1,308

thanks a lot judith

ur solution was really helpful