‎2007 Nov 19 11:13 AM
what function module will specify which date is greater and which date is lesser when we have 2 dates.
‎2007 Nov 19 12:53 PM
hi leela,
no need to use Function Module for this small issue because if you use it will take much time to run.Better you compare like
data: date1 type sy-datum,
date2 type sy-datum.
if date1 gt date2
MESSAGE 'Date1 is greater.' type 'I'.
else
MESSAGE 'Date2 is greater.' type 'I'.
or otherwise you can use
'FIMA_DAYS_AND_MONTHS_AND_YEARS' OR
'DAYS_BETWEEN_TWO_DATES' OR
REWARDS IF USEFUL
‎2007 Nov 19 11:15 AM
data:x1 like sy-datum.
data:x2 like sy-datum.
if x2 > x1.
write:/ x2 , 'is high'.
else.
write:/ x1 , 'is High'.
endif.
Message was edited by:
Vishnu Reddy
Message was edited by:
Vishnu Reddy
‎2007 Nov 19 11:17 AM
Hi,
I don't think you need FM for this.
Try this...
DATA : date1 LIKE sy-datum,
date2 LIKE sy-datum.
IF date1 GT date2.
------" do something
ELSE.
------
ENDIF.
‎2007 Nov 19 11:17 AM
DATA V_DIFF TYPE I.
PARAMETERS P_BIRTHD LIKE SY-DATUM.
CALL FUNCTION 'DAYS_BETWEEN_TWO_DATES'
EXPORTING
I_DATUM_BIS = SY-DATUM
I_DATUM_VON = P_BIRTHD
IMPORTING
E_TAGE = V_DIFF
EXCEPTIONS
DAYS_METHOD_NOT_DEFINED = 1
OTHERS = 2.
IF SY-SUBRC EQ 0.
WRITE:/ V_DIFF, 'DAYS HAVE PASSED SINCE', P_BIRTHD.
ELSE.
WRITE:/ 'ERROR IN CALCULATION'.
ENDIF.
‎2007 Nov 19 11:18 AM
hi,
u need not go for a FM, u can just subtract the dates and find which s higher
‎2007 Nov 19 11:18 AM
Hi,
SD_DATETIME_DIFFERENCE it gives the difference in Days and Time for 2 dates
Reward if helpful
‎2007 Nov 19 11:19 AM
Hi,
You don't need any function to compare date, SAP do that without any function.
date_1 - date_2 will give you number of day between date_1 and date_2 ....
You need function if you want to work of factory calendar.
You can compare these using the function module DURATION_DETERMINE. This fuction will give you the difference, and it can be in a view different units, such as the difference in days, months, etc.
Regards,
Omkar.
Message was edited by:
Omkaram Yanamala
‎2007 Nov 19 11:30 AM
hi leela,
you can use the following function module :
SD_DATETIME_DIFFERENCE Give the difference in Days and Time for 2 dates.
reward points if helpful..
‎2007 Nov 19 11:57 AM
Hi,
You can do as below :
parameter : date1 like sy-datum,
date2 like sy-datum.
INITIALIZATION.
date1 = '20070130'.
date2 = '20070225'.
START-OF-SELECTION.
if date1 GT date2.
write : 'date1 is greater'.
else.
write : 'date2 is greater'.
endif.Thanks,
Sri.
‎2007 Nov 19 12:53 PM
hi leela,
no need to use Function Module for this small issue because if you use it will take much time to run.Better you compare like
data: date1 type sy-datum,
date2 type sy-datum.
if date1 gt date2
MESSAGE 'Date1 is greater.' type 'I'.
else
MESSAGE 'Date2 is greater.' type 'I'.
or otherwise you can use
'FIMA_DAYS_AND_MONTHS_AND_YEARS' OR
'DAYS_BETWEEN_TWO_DATES' OR
REWARDS IF USEFUL