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: 

Get no. of Quarters between two dates.

Former Member
0 Kudos

Hi,

I want to know if there is any customized FM to find the no. of Quarters between two dates.

for Example:-

Date1 - 02.01.2009

Date2 - 31.10.2009

So the no of quarters should come to 4. Is there any customized FM to find the quarter?

Regards

Lalit

1 REPLY 1

Former Member
0 Kudos

Hi,

am not sure about the FM, but it can be acheived by writing small piece of code:

calculate the no of days between 2 dates and divide by 90.

DATA : date1 TYPE sy-datum,

date2 TYPE sy-datum,

var1 TYPE i,

rem TYPE i.

date1 = '20090102'.

date2 = '20091031'.

var1 = date2 - date1.

rem = var1 MOD 90.

var1 = var1 DIV 90.

IF rem GT 0.

var1 = var1 + 1.

ENDIF.

WRITE : var1.