Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

/SDF/CMO_DATETIME_DIFFERENCE

Former Member
0 Likes
508

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.

1 REPLY 1
Read only

Former Member
0 Likes
325

Solved USe EXPORTING EARLIEST