09-18-2008 6:09 AM
Hi Experts,
My reqirement is to subtract date from sy-datum.
for example:
I have two dates as given below:
date = 20021216.
sy-datum .
My requirement is to substract date(20021216) from sy-datum(20080918) and store that value in a variable.
Please suggest a function module for that.
Thanks in advance.
Regards,
Dasari
09-18-2008 6:10 AM
09-18-2008 6:11 AM
please define variable of type i,
data : diff type i.
diff = ur_date - sy-datum.
u will got difference in days.
09-18-2008 6:15 AM
09-18-2008 6:15 AM
Hi
u can try mask function.
through u can process on date .
otherwise go through this code....
DAT1 = ITAB-HSDAT.
YY = DAT1(4).
MM = DAT1+4(2).
IF MM = '00' AND YY = '0000'.
MM = ' '. YY = ' '.
ELSE.
concatenate MM '/' YY into ITAB-output.
ENDIF.
DAT2 = ITAB-VFDAT.
YY1 = DAT2(4).
MM1 = DAT2+4(2).
IF MM1 = '00' AND YY1 = '0000'.
MM1 = ' '. YY1 = ' '.
ELSE.
concatenate MM1 '/' YY1 into ITAB-output1.
ENDIF.
Regards
Annasaheb
09-18-2008 6:17 AM
09-18-2008 6:39 AM
Hi Kumar,
Try this way :
data :
w_date type sy-datum value '20020918',
w_var type p decimals 2.
w_var = sy-datum - w_date.
write 😕 w_var.
This will store the number of days in w_var.
Regards,
Swapna.