Skip to Content
avatar image
Former Member

how to check if the sy-date is between two dates?

Hi experts,

Can u tell me how to check if the sy-datum is between two dates in a where clause?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • Best Answer
    avatar image
    Former Member
    Dec 04, 2008 at 09:52 AM

    Hi,

    Use BETWEEN statement.

    WHERE sy-datum BETWEEN <dtart_date_date

    Thanks

    Nitesh

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 04, 2008 at 09:55 AM

    Hi,

    please explain exactly what u want...

    Regards,

    neha

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 04, 2008 at 09:56 AM

    Hi,

    USE BETWEEN statement.please see the link below for details:

    http://books.google.com/books?id=6YU5-HqV5vIC&pg=PA131&lpg=PA131&dq=checkingifthesy-datumisbetweentwo+dates%2Bsap&source=bl&ots=8OksihNn3D&sig=B5KOkGeDQXyM-KTfx4E4Laadeag&hl=en&sa=X&oi=book_result&resnum=1&ct=result.

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 04, 2008 at 09:57 AM
    DATA :
       t_vbak TYPE TABLE OF vbak.
    DATA :
       w_d1 TYPE d,
       w_d2 TYPE d.
    
    SELECT *
       FROM vbak
       INTO TABLE t_vbak
       WHERE erdat BETWEEN w_d1 AND w_d2.
    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 04, 2008 at 10:00 AM

    hi

    in where condition you can do in two types:

    p_date1 = lower date

    p_date2 = higher date

    1)

    where sy-datum between p_date1 and p_date2.

    2)menthod is

    where sy-datum ge p_date1

    and sy-datum le p_date2.

    Both will work.. try once..

    UR's

    GSANA

    Add comment
    10|10000 characters needed characters exceeded