cancel
Showing results for 
Search instead for 
Did you mean: 

FM for calculating dates

Former Member
0 Kudos

HI FRNS,

i need to calculate all the dates within a selection period ...

in an internal table ..

for example :

1/5/2008 to 20 /6/2008

thn i need in my internal table ...

1/5/2008

2/5/2008

.........

.............

19/6/2008

20/6/2008

is there any solution .

Thanks and Regards

Priyank Dixit

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Priyank,

Lets say low_date = 1/5/2008 and high date = 20 /6/2008

( both these varaibles be of type sy-datum).

While low_date <= high_date

append low_date to itab.

low_date = low_date + 1.

endwhile.

rgds

Manish

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi

Good

Please check the below sdn link, hope this will help you to solve your problem.

https://forums.sdn.sap.com/post!reply.jspa?threadID=1038784

Thanks

mrutyun^

Former Member
0 Kudos

FIMA_DAYS_BETWEEN_TWO_DATES

use this FM

it will work for sure

Former Member
0 Kudos

first find out how many days are there between the dates ..take it as X..you have FM to do that.

then use a DO X times stmnt..

inside the Do use the FM

RP_CALC_DATE_IN_INTERVAL_SG

and give the number of days as 1.

this fm will give u the next date..

keep appendin gthis values to an itab..

i hope this will help u.

regards

Former Member
0 Kudos

Hi Priyank,

When date range is given in input, you can capture the diff. between the dates and then use DO ENDDO loop for that many times and go on incrementing date by 1 and append it in internal table.

For example :

so_date BT 01.10.2008 & 07.10.2008

then get the diff.

w_diff = so_date-high - so_date-low.

do w_diff times

it_date-dates = so_date-low.

append it_dates.

so_date-low = so_date-low + 1.

enddo.

You can work out with this logic....

Hope this solves your problem.

Regards,

Shailesh Jadhav

Former Member
0 Kudos

and wat abt the leap year ..and the month wihich consist 30 days or 31 days ?

Regards .

Priyank dixit

Former Member
0 Kudos

you dont have to wrry about it

RP_CALC_DATE_IN_INTERVAL_SG

will take care of it