Shared Top Border

Enterprise Resource
Planning Portal

 

Advertise | Founder BLOG

ERPGenie.COM ABAP Tips and Tricks Database

THE ultimate
ERP website

 

Forums | Vote for us |

Google    Other Search Options

Login

Login to view more content!!!





Lost Password?
No account yet? Register

Registered Access

Poll

What area of ABAP are you interested in?
 
Home arrow Tips and Tricks arrow ABAP Reports arrow How to add hours, minutes and seconds
How to add hours, minutes and seconds PDF Print E-mail
User Rating: / 1
PoorBest 
Written by Anon.   
Friday, 11 May 2007

Considering a table ztime with a field ztime of type tims and has 2 records.
To get the sum of the times of these records  plz  see the following code :

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
*&--------------------------------------------------------------------
FORM GET-DATA.
SELECT * FROM ZTIME
INTO CORRESPONDING FIELDS
OF TABLE IZTIME.

ENDFORM.                    " GET-DATA

*&--------------------------------------------------------------------
*&      Form  CAL-TOT-TIME
*&--------------------------------------------------------------------
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
*&--------------------------------------------------------------------
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

Related Items:

 
< Prev   Next >

Google Search

Statistics

Contribution Activity
Utilities: 38
Tips and Tricks: 333
Sample Code: 164
Total Contributions: 550

Member Activity
Members: 6198 since 2/1/2007!
New: 6 since yesterday!
Visitors: 1024361
We have 1 guest online

Newest Members

Welcome our newest members:

Google Ads

Shared Bottom Border

Contact Us | Polls | Add URL | Contribute | Privacy | Terms | Feedback

Discussion Forum | BLOG | Consultants: Post your resume | Companies: Advertise on ERPGenie.COM | Post Job
Financials Consultant | Consultant Review | Gallia Consulting | Supply Chain Project | SAP Financials Forum
GenieHoldings.COM, Inc. | Genie Press | WorkflowGenie | ESAGenie | ERPTopSites | ABAP Tips and Tricks | SAP Solutions Database

EDIGenie | Searching Survivor