REPORT ZTIME .

DATA : IZTIME LIKE ZTIME OCCURS 0 WITH HEADER LINE.
DATA : TOTTIME LIKE SY-UZEIT.
DATA : N TYPE I, TOTHRS TYPE I.

START-OF-SELECTION.
PERFORM GET-DATA.
PERFORM CAL-TOT-TIME.
PERFORM WRITE.
END-OF-SELECTION.

*&--------------------------------------------------------------------
-*
*&      Form  GET-DATA
*&--------------------------------------------------------------------
-*
*       text
*---------------------------------------------------------------------
-*
*  -->  p1        text
*  <--  p2        text
*---------------------------------------------------------------------
-*
FORM GET-DATA.
SELECT * FROM ZTIME
INTO CORRESPONDING FIELDS
OF TABLE IZTIME.

ENDFORM.                    " GET-DATA

*&--------------------------------------------------------------------
-*
*&      Form  CAL-TOT-TIME
*&--------------------------------------------------------------------
-*
*       text
*---------------------------------------------------------------------
-*
*  -->  p1        text
*  <--  p2        text
*---------------------------------------------------------------------
-*
FORM CAL-TOT-TIME.


LOOP AT IZTIME.
TOTTIME = TOTTIME + IZTIME-ZTIME.
ENDLOOP.

LOOP AT IZTIME.
N = IZTIME-ZTIME+0(2).
TOTHRS = TOTHRS + N.
ENDLOOP.


ENDFORM.                    " CAL-TOT-TIME

*&--------------------------------------------------------------------
-*
*&      Form  WRITE
*&--------------------------------------------------------------------
-*
*       text
*---------------------------------------------------------------------
-*
*  -->  p1        text
*  <--  p2        text
*---------------------------------------------------------------------
-*
FORM WRITE.

DATA : HRS TYPE I, MIN TYPE I, SECS TYPE I.

LOOP AT IZTIME.
WRITE :/ IZTIME-ZTIME.
ENDLOOP.

SKIP 2.

HRS = TOTHRS.
MIN = TOTTIME+2(2).
SECS = TOTTIME+4(2).

WRITE :/ 'total time : ' , (2)HRS NO-GAP,
                       ':' NO-GAP,(2)MIN NO-GAP,
                       ':' NO-GAP,(2)SECS NO-GAP.

ENDFORM.                    " WRITE

Serkan AKKAVAK
Bilgisayar Mühendisi
serkurumsal@yandex.com