2007 Aug 13 10:27 AM
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.
2007 Aug 13 10:29 AM
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
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.
2007 Aug 13 10:29 AM
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
2007 Aug 13 10:31 AM
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>
2007 Aug 13 10:32 AM
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.
2007 Aug 13 10:32 AM
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.
2007 Aug 13 10:34 AM
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
2007 Aug 13 10:35 AM
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