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

Need validation logic

Former Member
0 Likes
863

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

8 REPLIES 8
Read only

Former Member
0 Likes
832

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

Read only

0 Likes
832

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.

Read only

0 Likes
832

When i executed report with this valiation,it is giving Dump.

regards,Ajay

Read only

0 Likes
832

Hi Ajay,

Can you post your code??

and what does the dump analysis say??

Read only

Former Member
0 Likes
832

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

Read only

0 Likes
832

HI,

year should be dynamic ..not static .

regards,AJay

Read only

Former Member
0 Likes
832

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

Read only

0 Likes
832

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