Skip to end of metadata
Go to start of metadata

*-----------------------------------------------------------------------------------------------------*

* the main objective of this program is to display the difference of dates in seconds

*----------------------------------------------------------------------------------------------------* 

 REPORT ztest.

*-----------------------------------------------------------------------------------------------------*

*            data declarations

*-----------------------------------------------------------------------------------------------------*

DATA : lv_seconds TYPE sytabix .

data: l type i ,
j(10) type c ,
k(12) type c .

*-----------------------------------------------------------------------------------------------------*

*            selection screen 

*-----------------------------------------------------------------------------------------------------*

parameters: p_date1 type sy-datum,
                    p_date2 type sy-datum.

*-----------------------------------------------------------------------------------------------------*

*                     start of selection  

*-----------------------------------------------------------------------------------------------------*

start-of-selection .

CALL FUNCTION 'SWI_DURATION_DETERMINE'
EXPORTING
start_date = p_date1
end_date = p_date2
start_time = sy-uzeit
end_time = sy-uzeit
IMPORTING
duration = lv_seconds.

l = lv_seconds.
j = l / 60 .
k = l / 3600 .

*------display the final output

WRITE :/ k ,'hours' .
write:/ j , 'minutes' .
write:/ l ,'seconds' .

output for this program

Input valuse :

p_date1       11.12.2008 

p_date2     12.12.2008

output will be :

          24  hours
     1440  minutes
    86,400  seconds

  • No labels