‎2006 Nov 14 5:50 AM
hi all,
we have a requirement to calculate the difference date.
for eg: we have a field "datecnt = 4" and "date1 = 14-1-2006(i.e today date)"
the requirement is to subract datecnt from date1 such that the resultant should
be date1-datecnt = 10-11-2006.
is there any readily available function module for the same.
Thanks in Advance,
Kishore Kumar Yerra.
‎2006 Nov 14 5:52 AM
no need of function module for this...this can be done directly...take a vriable v1 like sy-datum.
now, V1 = date1 - datecnt......the value is stored in the V1 field...
V1 = 14/11/2006 - 4...So, V1 will have 10/11/2006.
‎2006 Nov 14 5:52 AM
no need of function module for this...this can be done directly...take a vriable v1 like sy-datum.
now, V1 = date1 - datecnt......the value is stored in the V1 field...
V1 = 14/11/2006 - 4...So, V1 will have 10/11/2006.
‎2006 Nov 14 5:54 AM
‎2006 Nov 14 5:55 AM
hi kishore ,
just try this ..
data: v_date like sy-datum,
v_dateold like sy-datum.
v_date = sy-datum.
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
date = v_date
days = 04
months = 00
SIGNUM = '-'
years = 00
IMPORTING
CALC_DATE = v_dateold.
write:/'Current date', v_date,
'Old date ', v_dateold.regards,
vijay
‎2006 Nov 14 5:58 AM
Hi,
Try this
CALL FUNCTION 'RP_CALC_DATE_IN_INTERVAL'
EXPORTING
<b> date = 11/14/2006</b>
<b>days = 4 </b>
months = 0
<b> signum = - </b>
years = 0
IMPORTING
calc_date = result.
Make sure the sign is minus if u want to subtract and plus if u want to add. dont worry about months and years....
‎2006 Nov 14 6:01 AM
hi kishore
use this FM.
data : wa_date type sy-datum.
call function 'RP_CALC_DATE_IN_INTERVAL'
exporting
date = sy-datum
days = 04 --------------------> give ur required date
months = 0
years = 0
signum = '-'
importing
calc_date = wa_date.
write :/ wa_date. -> new minised date
Note
signum = '+' "
signum = '-' "
rgds
Anver
if hlped pls mark points
‎2006 Nov 14 6:15 AM
Hi
i have given a exaple u can also simply execute and give l3 = <some number>
is is suitable for ur requirement.....
<< u can also use FM , some has posted in this list,, u can also use that>>
data: l1 like sy-datum,
l2 like sy-datum,
l3 type i.
l2 = sy-datum.
l3 = 4.
l1 = l2 - l3.
write:/ l1 dd/mm/yyyy.
out put is: 10.11.2006
Regards,
Ramesh.
‎2006 Nov 14 6:41 AM
Hi,
Use the function module
HR_HK_DIFF_BT_2_DATES
(HR-HK: Calculate the days, months and years between)
WDKAL_DATE_ADD_FKDAYS
To find out different between dates by considering factory calender.
Regards,
Irfan Hussain
Note: Do reward helpful answers.