Application Development 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: 

Question regarding comparison

Former Member
0 Kudos

I have a date stored in a variable vdat..

I want to know if this date is in between today and with in 7 days from today and depending on that, I want to perform some conditions.

How to do that?

Thanks a lot.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello nuren,

you can use range for checking

Ranges: r_date for vdat occurs 0.

r_date-sign = 'I'.

r_date-option = 'BT'.

r_date-low = sy-datum.

r_date-high = sy-datum + 7.

if yourdatefield IN r_date.

with in 7 days.

Else.

outside 7 days.

ENDIF.

Thanks,

Amit

3 REPLIES 3

Former Member
0 Kudos

Hello nuren,

you can use range for checking

Ranges: r_date for vdat occurs 0.

r_date-sign = 'I'.

r_date-option = 'BT'.

r_date-low = sy-datum.

r_date-high = sy-datum + 7.

if yourdatefield IN r_date.

with in 7 days.

Else.

outside 7 days.

ENDIF.

Thanks,

Amit

Former Member
0 Kudos

hi Nuren,

Do this way...

<b>
data : v_date type sy-datum value '29/06/2006',
       v_final type sy-datum,
       v_week type sy-datum,
       v_today type sy-datum.
      
       v_today = sy-datum.
       v_week = sy-datum - 7.
       if ( v_date GE v_today ) and ( v_date LE V_WEEK ).
        WRITE : 'TRUE'.
       else.  
        WRITE : 'FALSE'.
       ENDIF.
.</b>

Reward if it helps...

Regards,

Santosh

Message was edited by: Santosh Kumar P

former_member181966
Active Contributor
0 Kudos

Also look at FMs

<b>WDKAL_DATE_ADD_FKDAYS

HR_SEN_CALE_DAYS_DATE</b>

Thanks

Saquib