05-03-2004 3:21 PM
Hello,
I want to calculate a new date (p.e. today + 3 months = 90 days)? I've tried to do this with the convert date and convert inverted-date, but the result was, that I ended with a date that was wrong (p.e. 43.04.2004).
Can someone help me?
Kind Regards,
S. Thomas
05-03-2004 6:43 PM
Hi Sylvie.
If you want to add 90 days.
Just do t1 = sy-datum + 90.
The system will automatically take care of the addition.
But if you want to add 3 months, then I would say you put in your piece of code.
a. Fetch the month component
b. add 3 to month component
c. if month component greater than 12 then month = month -12.
d. year = year + 1.
Pavan
05-04-2004 2:33 PM
05-05-2004 5:19 AM
Hi,
You can even check this function modules, it works fine.
Function Module Name:: ADD_TIME_TO_DATE
Short Description :: Adds months/days/years to date.
Entering a negative value will subtract from the date.
Parameters ::
Exporting:
I_IDATE : Initial date
I_TIME : Quantity to add
I_IPRKZ : Unit of time(D:day, M:month, W:week, Y:year)
Importing:
O_IDATE : OUTPUT DATE.
Message was edited by: Bharath Kumar B
05-05-2004 11:01 PM
To solve the problem use function module
DATE_CONV_EXT_TO_INT
Hope it works.
let me know if it´s the case.
05-06-2004 10:32 AM
The function module CALCULATE_DATE also adds/subtracts days and months to/from a date. The following website also demonstrates a number of ways to add days/months taking into account working and non working days if that is any use. http://www.sapdevelopment.co.uk/tips/date/datehome.htm
CALL FUNCTION 'CALCULATE_DATE'
EXPORTING
DAYS = '0'
months = '01'
start_date = p_date
IMPORTING
result_date = p_date.
Message was edited by: Mart