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

calculation using dates

Former Member
0 Likes
604

Hi All,

I have a posting date whose value for eg (12/31/2005). i want to calculate whether it is 60-90 days lesser than the system date. how to achieve this in abap.

Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
589

REPORT YCHATEST.

DATA:DIFF TYPE I.

PARAMETER : P_DATE LIKE SY-DATUM.

DIFF = SY-DATUM - P_DATE.

IF DIFF GT 60 AND DIFF LT 90.

WRITE : / 'true'.

ELSE.

WRITE : / 'false'.

ENDIF.

Reward points if helpful and close the thread

4 REPLIES 4
Read only

Former Member
0 Likes
590

REPORT YCHATEST.

DATA:DIFF TYPE I.

PARAMETER : P_DATE LIKE SY-DATUM.

DIFF = SY-DATUM - P_DATE.

IF DIFF GT 60 AND DIFF LT 90.

WRITE : / 'true'.

ELSE.

WRITE : / 'false'.

ENDIF.

Reward points if helpful and close the thread

Read only

0 Likes
589

it could be IF DIFF GE 60 AND DIFF LE 90.

Regards,

Suresh Datti

Read only

0 Likes
589

You could also do something like this.



report zrich_0001.

ranges: r_datum for sy-datum.

parameters: p_datum type sy-datum.

r_datum-sign = 'I'.
r_datum-option = 'BT'.
r_datum-low = sy-datum - 90.
r_datum-high = sy-datum - 60.
append r_datum.

if p_datum in r_datum.
Write:/ 'Yep the date is in the range'.
else.
Write:/ 'Nop the date is not in the range'.
endif.





Regards,

Rich Heilman

Read only

0 Likes
589

thank u everyone. the problem is solved.