‎2006 Jul 18 7:48 AM
Hi all
Can anyone suggest me the function module which satisfies below scenario:
Suppose i enter FROM date as :18.07.2006
and TO date as :20.07.2006
I should get number of days between these two dates as 1 and value :19.07.2006.
Thanks in advance
Regards
Neha Kapoor
‎2006 Jul 18 7:51 AM
Hi,
Check this function modules
"SD_DATETIME_DIFFERENCE"
or
"HR_HK_DIFF_BT_2_DATES"
Thanks and Regards,
Bharat Kumar Reddy.V
Message was Added by: Bharat Reddy V
‎2006 Jul 18 9:35 AM
‎2006 Jul 18 7:53 AM
Hi Neha,
Use this FM
HR_E_NUM_OF_DAYS_OF_MONTH (To get no.of days of the month)
Reward points if helpful.
Regards,
Harini
‎2006 Jul 18 7:54 AM
check this one .<b>CSCP_PARA1_GET_PERIODS</b> and Time uint is D.
Regards
Prabhu
‎2006 Jul 18 7:56 AM
Hi Neha,
You can use <b>DAYS_BETWEEN_TWO_DATES</b> FM to get the days between 2 dates.
PARAMETER:p_date1 TYPE dats,
p_date2 TYPE dats.
DATA:lv_diff TYPE i,
lv_no_date type i.
CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
EXPORTING
i_datum_bis = p_date1
i_datum_von = p_date2
IMPORTING
e_tage = lv_diff
EXCEPTIONS
days_method_not_defined = 1
OTHERS = 2.
IF sy-subrc <> 0.
WRITE:/ 'Error'.
ELSE.
WRITE:/ lv_diff.
ENDIF.
if lv_diff < 0.
lv_diff = lv_diff * -1.
endif.
lv_no_date = lv_diff - 1.
<b>Reward if helpful</b>
Rgds,
‎2006 Jul 18 8:01 AM
Hi neha,
1. just copy paste
2. It will list ALL THE DATES which fall in between,
and also the NUM OF DAYS.
3.
report abc.
PARAMETERS : FROMDATE TYPE SY-DATUM DEFAULT '20060701'.
PARAMETERS : TODATE TYPE SY-DATUM DEFAULT SY-DATUM.
perform mydays using fromdate todate.
*----
FORM
*----
FORM MYDAYS USING MYFROMDATE MYTODATE.
DATA : CURDATE TYPE SY-DATUM.
DATA : NUMOFDAYS TYPE I.
CURDATE = MYFROMDATE + 1.
DO.
IF CURDATE >= MYTODATE.
EXIT.
ENDIF.
NUMOFDAYS = NUMOFDAYS + 1.
WRITE 😕 CURDATE.
CURDATE = CURDATE + 1.
ENDDO.
WRITE 😕 '------- Num of days ' , numofdays .
ENDFORM. "MYDAYS
regards,
amit m.
‎2006 Jul 18 9:31 AM
Hi,
declare the 2 dates that you have as DATS or type sy-datum. ( say d1 & d2 )
now declare a variable of type integer or NUMC. ( say n1 )
now n1 = d1 - d2...will give you the number of days between the 2 dates....
‎2006 Jul 18 9:34 AM
Hi,
declare the 2 dates that you have as DATS or type sy-datum. ( say d1 & d2 )
now declare a variable of type integer or NUMC. ( say n1 )
now n1 = d1 - d2...will give you the number of days between the 2 dates....hence n1-1 should give u the difference between the two dates, also d1 + ( n1 - 1 ) should give the desired date.
Thanks & Regards
Saikiran
‎2006 Jul 24 5:24 AM
hi all
try this for finding difference between two dates.
data : temp type i.
data : d1 type sy-datum,
d2 type sy-datum.
d1 = '20060720'.
d2 = '20060718'.
temp = d1 - d2.
write : / temp.