Skip to Content
0
Former Member
May 01, 2009 at 09:07 AM

Function Module issue !!

39 Views

Dear All,

I am using the fuction module /SDF/CMO_DATETIME_DIFFERENCE to calculate the diffence days between 2 dates.Here i am want to write the difference days as output? How to import and write the DIFFDAYS? my code is as below.

&----


*& Report ZTESTMAIN

*&

&----


*&

*&

&----


Report 556.

Parameters:p_frdate type d,

p_todate type d.

data: date1 type d,

date2 type d.

data: datediff type d.

date1 = p_frdate.

date2 = p_todate.

CALL FUNCTION '/SDF/CMO_DATETIME_DIFFERENCE'

EXPORTING

DATE1 = date1

  • TIME1 =

DATE2 = date2

  • TIME2 =

IMPORTING

DATEDIFF = datediff

  • 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.

  • CALL FUNCTION '/SDF/CMO_DATETIME_DIFFERENCE'

  • EXPORTING

  • DATE1 = p_frdate.

  • TIME1 =

  • DATE2 = p_todate.

    • TIME2 =

    • IMPORTing

  • DAteDIFF = datediff

    • 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.

  • Write : / datediff.

    Write is not working here PLEASE SUGGEST ME HOW TO DO THIS?

    Thanks & Regards,

    Murali.