REPORT  ztestr_5.

DATA lv_days TYPE p.

PARAMETERS p_date1 TYPE sy-datum,
             p_date2 TYPE sy-datum.

CALL FUNCTION '/SDF/CMO_DATETIME_DIFFERENCE'
 EXPORTING
   DATE1                  p_date1
*   TIME1                  =
   DATE2                  p_date2
*   TIME2                  =
 IMPORTING
   DATEDIFF               lv_days
*   TIMEDIFF               =
*   EARLIEST               =
 EXCEPTIONS
   INVALID_DATETIME       1
   OTHERS                 2
          .
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.


WRITE / lv_days.

Serkan AKKAVAK
Computer Engineer
ABAP Developer & SAP MM SD Consultant