Skip to Content
0
Former Member
Oct 21, 2011 at 05:05 AM

help in FM /SDF/CMO_DATETIME_DIFFERENCE

427 Views

i am using the function module /SDF/CMO_DATETIME_DIFFERENCE to calculate the days between two dates.

i m getting the output. but what i want is if it does the receives blank as one value( from the two given dates) in exporting.........then it should show blank as diff days.(importing diff days).

my code is:

I_TAB-ERDAT

I_TAB-GP_DATE

I_TAB-BC_GP.............ALL THESE HAVE BEEN DECLARED IN I_TAB. AND THWY HAVE THEIR VALUES IN DATE FORMAT IN I)TAB.

CALL FUNCTION '/SDF/CMO_DATETIME_DIFFERENCE'

EXPORTING

DATE1 = I_TAB-ERDAT

  • TIME1 =

DATE2 = I_TAB-GP_DATE

  • TIME2 =

IMPORTING

DATEDIFF = I_TAB-BC_GP

  • TIMEDIFF =

  • EARLIEST =

  • EXCEPTIONS

  • INVALID_DATETIME = 1

  • OTHERS = 2

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

DO WE HAVE ANY PROVISION IN THIS FM THAT IF THERE IS BLANK SOMEWHERE IN I_TAB-GP_DATE THEN IT SHOULD SHOW

I_TAB-BC_GP AS BLANK.

HOWEVER IT IS RECEIVING VALUE IN ANOTHER EXPORTING PARAMETER THAT IS I_TAB-ERDAT.