‎2007 Nov 22 6:01 AM
Hi All,
Can any one specify the function module to add days to current date?
e.g. if i add 7 days to 31st Jan, it should come as 7th feb, not 38 .
Plz specify with example.
‎2007 Nov 22 6:04 AM
Hi
You can simply add the days to date as:
data: date1 like sy-datum, date2 like datum.
date2 = sy-datum + 10.
write: / date2.
it gives after 10 days date
Regards
Anji
‎2007 Nov 22 6:06 AM
Hi, Debarshi.
It's no need to use FM, you can add days directly.
for example,
data now type d value '20070131'.
now = now + 7.
Regards,
feng.
‎2007 Nov 22 6:14 AM
Its easy to write a new Function Module!!
I remember writing a new function module some time back to convert Fiscal Year to Calendar Year & Month.
‎2007 Nov 22 6:17 AM
no need of FM,
if the variable type is sy-datum system will automatically do this task when u add simply
‎2007 Nov 22 6:18 AM
Hi
refer this
CALL FUNCTION 'RE_ADD_MONTH_TO_DATE'
EXPORTING
months = '2'
olddate = lv_date
IMPORTING
newdate = lv_newdate.
regards,
Prashant
‎2014 Jul 04 7:12 AM
Hi,
Use following function module (ADD_TIME_TO_DATE) for your requirement.
DATA : F_DATE LIKE SY-DATUM,
T_DATE LIKE SY-DATUM,
V_IPRKZ LIKE MARA-IPRKZ.
V_IPRKZ = 'D'.
F_DATE = '20120509'.
* Convert to Internal Representation
CALL FUNCTION 'CONVERSION_EXIT_PERKZ_INPUT'
EXPORTING
INPUT = V_IPRKZ
IMPORTING
OUTPUT = V_IPRKZ.
CALL FUNCTION 'ADD_TIME_TO_DATE'
EXPORTING
I_IDATE = F_DATE " Your Original Date Here
I_TIME = 5 " No.of Days or Months or Years you want to add to Given date
I_IPRKZ = V_IPRKZ " Indicator D = Days M = Months Y = Years
* I_RDMHD =
IMPORTING
O_IDATE = T_DATE " Processed Date
.
in above example,
I_TIME = 5
I_IPRKZ = 'D'
So, it will add 5 days to given date.
-Thanks,
Chintan
‎2020 Jan 15 9:55 PM
Please do not use D M Y for the field I_IPRKZ.
the proper amounts are
blank(for day), 1 (for week), 2 (for month), 3 (for year)