‎2008 Nov 21 7:32 AM
ABAP Experts,
I have already first searched SDN for threads on function module /SDF/CMO_DATETIME_DIFFERENCE.
However my question is not answered by seeing the threads and hence I am posting a question.
CALL FUNCTION '/SDF/CMO_DATETIME_DIFFERENCE'
EXPORTING
DATE1 = DATE_A
DATE2 = DATE_B
IMPORTING
DATEDIFF = VAR1
EXCEPTIONS
INVALID_DATETIME = 1
OTHERS = 2.
Now DATE_A is greater than DATE_B, and result is positive, which is fine.
When I reverse the order such that
EXPORTING
DATE1 = DATE_B
DATE2 = DATE_A
i get the same magintude of difference which is fine, but I want the opposite sign say - M
Now one option is to concatenate - sign on the magnitude, but for that i will have to compare the two dates which may be date_A in 2000 and date_B in say 2008, will a simple comarision work,
how do I get a negative sign to the magnitude.
‎2008 Nov 21 7:47 AM