2007 Jul 19 3:17 PM
Hi al,
I have period field on selection csreen , how can i validate the period field start from JULY of 2007 and June of 2008.
How cai write validation.
regards,
Ajay
2007 Jul 19 3:20 PM
if period is month, thendo something like this.
if period < 7 and year = 2007.
message e000(zz) with 'Invalid period'.
endif.
if period > 6 and year = 2008.
message e000(zz) with 'Invalid period'.
endif.
REgards,
Ravi
2007 Jul 19 3:27 PM
data: current_year(4) type n,
next_year(4) type n.
current_year = sy-datum+0(4).
if period < 7 and year = current_year.
message e000(zz) with 'Invalid period'.
endif.
next_year = current_year + 1.
if period > 6 and year = next_year.
message e000(zz) with 'Invalid period'.
endif.
2007 Jul 19 3:40 PM
When i executed report with this valiation,it is giving Dump.
regards,Ajay
2007 Jul 19 3:44 PM
Hi Ajay,
Can you post your code??
and what does the dump analysis say??
2007 Jul 19 3:22 PM
Hello,
Do like this.
at selection screen on P_data.
data: lv_start like sy-datum value '20070701',
lv_end like sy-datum value '20080630'.
if P_date between lv_start and lv_end.
else.
" Error Message
endif.
Vasanth
2007 Jul 19 3:24 PM
2007 Jul 19 3:44 PM
see if the reason for the short dump is elsewhere in the code. that piece of code is suitable for you. there shouldn't be any prob in that.
<b> better u give ur code!</b>
regards,
srinivas
2007 Jul 19 4:00 PM
see the code.
FORM VALIDATE_PERIOD .
data: L_current_year(4) type n,
L_next_year(4) type n.
L_current_year = sy-datum+0(4).
if S_MONAT < 7 and S_GJAHR = L_current_year.
message e000(zz) with 'Invalid period'.
endif.
L_next_year = L_current_year + 1.
if S_MONAT > 6 and S_GJAHR = L_next_year.
message e000(zz) with 'Invalid period'.
endif.
ENDFORM. " VALIDATE_PERIOD
regards,
AJay