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

use between in IF statement

Former Member
0 Likes
24,466

How to use between statement in IF statement.

if date is in betweem 12.07.2007 & 31.12.9999.

thanks in advance

1 ACCEPTED SOLUTION
Read only

Former Member
6,285

Hi,

v_date = sy-datum.

If v_date >20070712 and v_date < 99991231.

Reward if useful.

Regards,

naveen

8 REPLIES 8
Read only

Former Member
6,286

Hi,

v_date = sy-datum.

If v_date >20070712 and v_date < 99991231.

Reward if useful.

Regards,

naveen

Read only

Former Member
0 Likes
6,285

Why don't you populate a ranges for DATE with low value and high value. Sign = 'I' and option eq 'BT'.

if DATE in R_DATE

your logic

Endif.

Let me know if this helps.

Read only

Former Member
0 Likes
6,285

hi

use this if statement....

if <condn1> and <condn2>.

-


-


endif.

condn1 -> greater than the given date

condn2 -> lesser than the given date

thanks,

reward if helpful....

Read only

KN-Nampoothiry
Active Participant
0 Likes
6,285

hi,

say v_date has the value to be checked.

v_date type dats.

if v_date gt '12072007' and v_date lt '31129999'.

*your Logic

endif.

Please ensure the format of the date you pass is same as the one you compare to.

Read only

Former Member
0 Likes
6,285

Hi,

Try this,

DATA: i1 TYPE i VALUE 5.

IF i1 BETWEEN 1 AND 19 .

WRITE:/ i1.

ENDIF.

Thanks,

Dharmishta

Message was edited by:

Dharmishta Suryavanshi

Read only

Former Member
0 Likes
6,285

hi vibhuti,

the code would be like :

data : req_date type dats.

req_date = sy-datum.

if req_date between '12072007' and '31129999'.

(your data)

endif.

regard's,

sohi.

Read only

Former Member
0 Likes
6,285

HI,

data:v_date type date.

if v_date between '2.03..2008' and '09.08.2008'.

endif.

Read only

Former Member
0 Likes
6,285

Hi Vibhuti,

Check the below code.

data: v_date type sy-datum value '20070921'.

if v_date between '20070901' and '20070930'.

write:/ 'Yes'.

else.

write:/ 'No'.

endif.