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

FM to increment date

Former Member
0 Likes
2,563

Hi all,

I need to add 3 days to the date i retrieve from a DB table and do further selection based on that. Is there any function module for adding days to a date ..........so taht it gives correct date based whether the month has 30 0r 31 days ........

thanks,

kavitha.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,362

Hi,

If you want to use FM, then try FM RP_CALC_DATE_IN_INTERVAL.

data: wa_date like sy-datum.

call function 'RP_CALC_DATE_IN_INTERVAL'

exporting

date = sy-datum

days = 3

months = 0

signum = '+'

years = 0

importing

calc_date = wa_date.

write: / wa_date.

<b>Reward points if this helps,</b>

Kiran

Message was edited by:

Kiran Kumar Somaroutu

6 REPLIES 6
Read only

Former Member
0 Likes
1,363

Hi,

If you want to use FM, then try FM RP_CALC_DATE_IN_INTERVAL.

data: wa_date like sy-datum.

call function 'RP_CALC_DATE_IN_INTERVAL'

exporting

date = sy-datum

days = 3

months = 0

signum = '+'

years = 0

importing

calc_date = wa_date.

write: / wa_date.

<b>Reward points if this helps,</b>

Kiran

Message was edited by:

Kiran Kumar Somaroutu

Read only

varma_narayana
Active Contributor
0 Likes
1,362

Hi Kavitha,

There is no need of any FM for this.

We can directly add the Value.

Eg.

V_DATE1 = V_DATE1 + 3.

This will add the no of days. It automatically takes the no of days in a month into consideration.

<b>Reward if Helpful</b>

Read only

Former Member
0 Likes
1,362

hi kavitha,

use the following code...

DATA : dt LIKE sy-datum.

CALL FUNCTION 'CALCULATE_DATE'

EXPORTING

days = '+3'

months = '0'

start_date = date you retrieved

IMPORTING

result_date = dt.

make sure , teh date you retrieved is in sy-datum format.

reward if helpful.

Read only

Former Member
0 Likes
1,362

HI,

You can use FM <b>RP_CALC_DATE_IN_INTERVAL</b>.

For Eg,

data: wa_date like sy-datum.

*Add 21 days to current date.

call function 'RP_CALC_DATE_IN_INTERVAL'

exporting

date = sy-datum

days = 3

months = 0

signum = '+'

years = 0

importing

calc_date = wa_date.

write: / wa_date.

Regards,

Padmam.

Read only

Former Member
0 Likes
1,362

Hello Kavitha,

For this simple thing no need to use function module.

Just add no_days to the date field.

If it is the end of the month, automatically updated to the next month.

Reward If Helpful

Regards

--

Sasidhar Reddy Matli

Read only

Former Member
0 Likes
1,362

hi

First you need to get the data into internal format. Then you can just add 3 days to it.

data: date(10) type c value '03/27/2006'.

data: datum type sy-datum.

start-of-selection.

call function 'CONVERT_DATE_TO_INTERNAL'

exporting

date_external = date

importing

date_internal = datum.

datum = datum + 3.

write:/ datum.

reward points for useful ans

Regards

Vivek