‎2009 Jun 16 1:58 PM
Hi friends,
I want to throw an error message when user enters in date field.My requirement is to restrict the user to enter only first day of the future months like 01.10.2009 or 01.12.2010...........not like 02.05.2009.
how to do it?
Thanks.
‎2009 Jun 16 2:03 PM
Hi,
Welcome to SDN.
Try this code.
parameter w_date like sy-datum.
At selection-screen.
if w_date+6(2) NE '01'.
message 'Enter the first day of the month' type 'E'.
endif.to check the whole future date
PARAMETERS: p_date LIKE sy-datum.
AT SELECTION-SCREEN.
IF p_date+6(2) <> '01'.
MESSAGE 'enter' TYPE 'E'.
ELSEIF p_date+0(4) < sy-datum+0(4).
MESSAGE 'wrong' TYPE 'E'.
ELSEIF p_date+4(2) < sy-datum+4(2).
MESSAGE 'Enter future month' TYPE 'E'.
ENDIF.Thanks&Regards
Sarves
‎2009 Jun 16 2:03 PM
‎2009 Jun 16 2:04 PM
‎2009 Jun 16 2:06 PM
not only date...i should also see the month & year because it should be only future date.
Thanks.
‎2009 Jun 16 2:24 PM
>
> not only date...i should also see the month & year because it should be only future date.
>
>
>
> Thanks.
Thats an easy task for an programmer, just code it for your own.
‎2009 Jun 16 2:06 PM
hi
Check this
PARAMETERS: s_name TYPE ERSDA.
if s_name <= sy-datum .
MESSAGE 'Error' TYPE 'I'.
Else.
MESSAGE 'Sucess' TYPE 'I'.
endif.
Thanks
‎2009 Jun 16 2:20 PM
Hi.. please use the below code.
parameters : p_date type sy-datum.
at selection-screen on p_date.
if p_date+6(2) NE '01' or p_date LE sy-datum.
message ' error in date' type 'E'.
endif.Edited by: soumya prakash mishra on Jun 16, 2009 3:22 PM
‎2009 Jun 16 2:23 PM