Skip to Content
V A

use between in IF statement

How to use between statement in IF statement.

if date is in betweem 12.07.2007 & 31.12.9999.

thanks in advance

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

8 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Sep 21, 2007 at 03:59 AM

    Hi,

    v_date = sy-datum.

    If v_date >20070712 and v_date < 99991231.

    Reward if useful.

    Regards,

    naveen

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 21, 2007 at 04:00 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 21, 2007 at 04:02 AM

    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....

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 21, 2007 at 04:12 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 21, 2007 at 04:15 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 21, 2007 at 04:29 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 21, 2007 at 04:45 AM

    HI,

    data:v_date type date.

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

    endif.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 21, 2007 at 06:51 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.