메뉴 건너뛰기

SAP 한국 커뮤니티

시간 계산, time difference

sapjoy 2014.05.16 19:57 조회 수 : 5916

 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