09-10-2008 9:46 PM
Hi Experts,
i need to subtract certain no of days from a given date . i am using the FM :SUBTRACT_TIME_FROM_DATE.
but this is returing the output as 00/00/0000.
My code is as follows:
data : gv_erdate type sy-datum.
l_lndat = 08142008
l_days = can have values 0,1,2...etc
gv_erdate
CALL FUNCTION 'SUBTRACT_TIME_FROM_DATE'
EXPORTING
I_IDATE = l_lndat
I_TIME = l_days
I_IPRKZ = 'D' (also tried with 1,2)
I_RDMHD =
IMPORTING
O_IDATE = gv_erdate
EXCEPTIONS
INVALID_PERIOD = 1
INVALID_ROUND_UP_RULE = 2
INTERNAL_ERROR = 3
OTHERS = 4
gv_erdate is 00000000.
Can some please help me.
thanks
Dan
09-10-2008 9:53 PM
Pass date in internal format.
l_lndat = '20080814'.
Regards,
Naimesh Patel
09-10-2008 9:52 PM
No need to use this FM(SUBTRACT_TIME_FROM_DATE) u can do this directly by using simple abap code:
data: l_date like sy-datum,
l_days type i.
l_date = sy-datum.
l_days = 2.
l_date = l_date - l_days.
09-10-2008 9:53 PM
Hi,
Yes, You can directly subract the days from the date.
data : date type sy-datum value '20080910',
days type i,
new_date type sy-datum.
days = 3.
new_date = date - days.
write 😕 new_date.
Regards,
Senthil
09-10-2008 9:53 PM
Pass date in internal format.
l_lndat = '20080814'.
Regards,
Naimesh Patel
09-10-2008 10:12 PM