‎2007 Feb 05 2:06 PM
Hi all,
I have a small Question. I need to add the time to the date. for example
if we take todays date ie 02.05.2007 and add 24 hours then the output should be
03.05.2007. if we add 48 hours then the output should be 04.05.2007.
Is there any function module to do this.
Please Give some solution.
Ranjith
‎2007 Feb 05 2:08 PM
‎2007 Feb 05 2:08 PM
https://forums.sdn.sap.com/click.jspa?searchID=1030563&messageID=2917434
check this example, u can use FM 'CATT_ADD_TO_TIME'
FM C14B_ADD_TIME
check its use from
https://forums.sdn.sap.com/click.jspa?searchID=1030563&messageID=1520791
dont forget to award points if found helpful
‎2007 Feb 05 2:16 PM
‎2007 Feb 05 2:19 PM
use fm CATT_ADD_TO_TIME
give field STDAZ = (no.of hours you want to add)
regds,
kiran
‎2007 Feb 05 2:21 PM
Please check the following code
DATA: start_date TYPE begda,
start_time TYPE begti,
add_value TYPE thour,
get_date TYPE begda,
get_time TYPE begti.
start_date = '20040706'.
start_time = '2300'.
add_value = '5.5'.
CALL FUNCTION 'CATT_ADD_TO_TIME'
EXPORTING
idate = start_date
itime = start_time
stdaz = add_value
IMPORTING
edate = get_date
etime = get_time
‎2007 Feb 05 2:27 PM
Hi Ranjith,
Use fucntion module <b>CATT_ADD_TO_TIME</b> to add time to a date.
Give Start time to IDATE, Start time to ITIME and no of hours to STDAZ then it will gives you the corresponding date in EDATE and the time in ETIME.
data:
v_date type sy-datum,
v_time type sy-uzeit.
CALL FUNCTION 'CATT_ADD_TO_TIME'
EXPORTING
idate = sy-datum ->Start date
itime = '000000' ->Start time
stdaz = '43' ->Add time in no of hours
IMPORTING
EDATE = v_date ->End date
ETIME = v_time. ->End time
write:/ v_date, v_time.
Thanks,
Vinay
‎2007 Feb 05 2:36 PM
Hi,
You can also use this FM RP_CALC_DATE_IN_INTERVAL.
call function 'RP_CALC_DATE_IN_INTERVAL'
exporting
date = sy-datum
days = 2 <--- 48 hours
months = 0
signum = '+'
years = 0
importing
calc_date = wa_date.
Regards,
Ferry Lianto