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

Problems with function RP_CALC_DATE_IN_INTERVAL

former_member393151
Participant
0 Likes
2,963

I've used this function successfully in the past for date calculations. However, it only accepts parameters for days to calculate that are of two digits in length. Is there any other function out there with the same functionality, but will accept parameters greater than 2 digits in length?

8 REPLIES 8
Read only

Former Member
0 Likes
2,083

Hi Heather,

But why do you want 3 digits??

because when it exceeds 31 days , increase the month...

if you want to subtract/add only no of days

then try this

date + no of days

20080327 + 125

Read only

0 Likes
2,083

That function module requires you to use years, days and months, rather than one unit like days.

But I guess you could always write your own very simple routine.

REPORT zz_temp.

data:  g_today    type d.
data:  g_future   type d.


g_today = sy-datum.

g_future = g_today + 333.

write g_future.

Read only

Former Member
0 Likes
2,083

data: v_date_store type sy-datum.

CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'

EXPORTING

date = sy-datum

days = 10

months = 00

signum = '+'

years = 00

IMPORTING

calc_date = v_date_store.

write:/ v_date_store.

see the date range is only 1-31 means 2 char field , why u require the 3 char field like..

regards,

venkat

Read only

0 Likes
2,083

I require a longer field because I'm pulling it from a table with master data (and can't control the users to only enter in a 2 character long field). Just hoping that I wouldn't have to code around this - and that there would be another option.

Read only

Former Member
0 Likes
2,083

hi if you pass more than the 2 chars it shows a type conflict in the fm and it will give the dump..so do like this..

if u had a field of length 7 .

data:p_date(2) type c.

data: v_data(7) type c value '1234567'.

if u want to pass the 2 char value use the offset condition..

p_date = v_data+0(2) .

or

p_date = v_date+5(2).

or if it a table field ..

v_test = itab-field.

p_date = v_test+0(2).

regards,

venkat.

Read only

0 Likes
2,083

Hi Heather,

Were you able to resolve this issue. I have a similar situation where I would need to calculate an end date on the basis of a start date and the number of days between the start and end dates and the number of days could be any length. One solution would be to parse the number of days internally by splitting it into days, months and years and pass it to the afore mentioned Function Module. Did you find a way to do this?

Thanks,

Puja.

Read only

0 Likes
2,083

I believe what I did was write a loop around the the call - reducing the number of days until I got a number it would work with. Not very elegant but it works....

Read only

Former Member
0 Likes
2,083

Hi,

Go through this link:

Regards

Adil