‎2007 May 23 1:29 PM
hi,
pls give me the code for finding out the difference between the two dates entered in select-options for validations to find whether the difference is less than 12 months or not.
and pls say me why do people say that it is a performance issue to have the difference more than a year
thanks and i will offer ten points for the answer,
thanking you,
‎2007 May 23 1:33 PM
Hi
12 months have 365 days, so you can write:
PATAMETERS: DAY_1 LIKE SY-DATUM,
DAY_2 LIKE SY-DATUM.
DATA DELTA TYPE I.
AT SELECTION-SCREEN.
DELTA = DAY_2 - DAY_1.
IF DELTA > 365.
MESSAGE ERROR
ENDIF.Max
‎2007 May 23 1:32 PM
Hi
Use FM HR_HK_DIFF_BT_2_DATES
Thanks
Sandeep
Reward if helpful
‎2007 May 24 5:11 AM
hello sandeep,
thanks for your kind reply
when i am using that function module like
keeping the importing days as
v_days type p
i am getting the type conflict error
please suggest me to keep exact types for using the fm
thanks in advance and will surely reward ten points if you give me the exact answer
‎2007 May 23 1:33 PM
Hi
12 months have 365 days, so you can write:
PATAMETERS: DAY_1 LIKE SY-DATUM,
DAY_2 LIKE SY-DATUM.
DATA DELTA TYPE I.
AT SELECTION-SCREEN.
DELTA = DAY_2 - DAY_1.
IF DELTA > 365.
MESSAGE ERROR
ENDIF.Max
‎2007 May 23 1:33 PM
Hi..
u want to get the diff of dates between the high and low values of a select-options .right?? thenu can simply say
diff = s_opt-high - s_opt-low where s_opt is the select-options of ur date .
i hope i am clear.if not let me know.
Regards,
kamal
‎2007 May 23 1:37 PM
DAYS_BETWEEN_TWO_DATES
MONTHS_BETWEEN_TWO_DATES Integer number
MONTHS_BETWEEN_TWO_DATES_NEW
Most universal FM to determine months (both integer and float values)
CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
EXPORTING
I_DATUM_BIS = x_faede-zfbdt
I_DATUM_VON = p_fdat
I_KZ_EXCL_VON = '0'
I_KZ_INCL_BIS = '0'
I_KZ_ULT_BIS = ' '
I_KZ_ULT_VON = ' '
I_STGMETH = '0'
I_SZBMETH = '1'
IMPORTING
E_TAGE = dias_v.
IF SY-SUBRC <> 0.
ENDIF.
donde:
x_faede-zfbdt -> 20050915
p_fdat -> 20050811
dias_v = 4
‎2007 May 23 1:38 PM
hi,
use the fun mod - RELATIVE_DATE_CALCULATE -- to find date after some duration
fun mod - <b> /SDF/CMO_DATETIME_DIFFERENCE -- for diff</b>
With Regards,
S.Barani
‎2007 May 24 5:20 AM
hi,
You can use aqny of these FM.
MONTHS_BETWEEN_TWO_DATES
MONTHS_BETWEEN_TWO_DATES_NEW
HR_99S_MONTHS_BETWEEN_DATES
HR_MONTHS_BETWEEN_TWO_DATES
and chk the diff in months is greater than 12 or not.
Regards
Anversha
‎2007 May 24 5:32 AM
‎2007 May 24 5:55 AM
‎2007 May 24 6:03 AM
Try these FMs,
1. HR_SGPBS_YRS_MTHS_DAYS
2. HR_SEN_CALE_DAYS_DURATION
‎2007 May 24 6:51 AM
hi sara,
as coding u can write as
data: date1 like sy-datum,
date2 like sy-datum
result(10) like type c.
if date2 - date1 >= 365.
write: /10 'hai'.
else.
write e000(zmessclas) with 'date range should be 365 days r 12 months'.
endif.
if helpful reward some points.
with regrads,
suresh babu aluri.