‎2007 Aug 17 7:29 AM
Dear friends,
I've been writing a report in which I have the date field on selection-screen. By default I have been displaying the system date on the selection-screen.
The reqiurement is that the user cannot execute the code for a date in past (less than the system date) or cannot give a date less than the sytem date
but can execute the same for a date in future (greater than the system date).
Can any one give me the logic for the same.
Regards,
Alok.
‎2007 Aug 17 7:32 AM
Hi
This is the code for u.
PARAMETERS : P_DATE TYPE SY-DATUM .
INITIALIZATION.
MOVE SY-DATUM TO P_dATE.
AT SELECTION-SCREEN ON P_DATE.
IF P_DATE < SY-DATUM.
MESSAGE 'Entered date cannot be in Past' Type 'E'.
**Raise any message that u created otherwise
ENDIF.
<b>Reward if Helpful</b>
‎2007 Aug 17 7:32 AM
Hi
This is the code for u.
PARAMETERS : P_DATE TYPE SY-DATUM .
INITIALIZATION.
MOVE SY-DATUM TO P_dATE.
AT SELECTION-SCREEN ON P_DATE.
IF P_DATE < SY-DATUM.
MESSAGE 'Entered date cannot be in Past' Type 'E'.
**Raise any message that u created otherwise
ENDIF.
<b>Reward if Helpful</b>
‎2007 Aug 17 7:33 AM
Hi
write the logic in the event at selection-screen on <date field>
if p_date < sy-datum.
message e000 with 'enter a data in the future'.
endif.
<b>Reward points for useful Answers</b>
Regards
Anji
‎2007 Aug 17 7:34 AM
AT SELECTION-SCREEN.
IF s_date LE sy-datum.
MESSAGE e001(error) WITH 'Date should be greater than system date'.
ENDIF.
ENDIF.
try using the above code.
reward if useful
‎2007 Aug 17 7:34 AM
Report Z10_SB_DATE MESSAGE-ID Z10SBAN.
AT SELECTION-SCREEN.
if d_date < sy-datum.
message e001 with d_date.
endif.
What this will do is that if the date(d_date) entered is less than current date,
an error message 001 (from message id z10sban) will be flashed in re
at the bottom and the execution will terminate then and there it self.
‎2007 Aug 17 7:35 AM
Alok,
if s_datum > sy-datum.
perform getdata.
else.
MESSAGE e034(zal) WITH s_datum.
In the message class zal give an message for 034.
In the subroutine getdata write the code.
K.Kiran.
Message was edited by:
Kiran K
‎2007 Aug 17 7:39 AM
Hi
parameters p_date like sy-datum default sy-datum.
at selection-screen.
if p_date < sy-datum.
message w003(zf).
endif.