‎2006 Jan 03 7:02 AM
Hi All,
I have values in fields KAKO-BEGZT (Start time in seconds (internal)) and KAKO-ENDZT (Finish time in seconds (internal)) which I want to convert into HH:MM:SS format.
Is there any FM existing. Or if anyone can tell me the logic of converting this value into HH:MM:SS format.
Problem is I don't know in which format data is stored in fields KAKO-BEGZT and KAKO-ENDZT.
Regards,
Pawan
‎2006 Jan 03 7:47 AM
Hi Pawan,
1. MONI_TIME_CONVERT
This FM will solve your problem.
Regards,
Amit M.
‎2006 Jan 03 7:21 AM
‎2006 Jan 03 7:39 AM
convert_time_input is converting time from external user format to internal SAP format.
to convert seconds into hours, mins and secons.
you can use the following code sample.
data: output type string .
parameters: p_time type i .
data: wl_hours type i,
wl_minutes type i,
wl_seconds type i,
wl_hr_rem type i,
wl_min_rem type i,
wl_min(4) type p decimals 2,
wl_sec(4) type p decimals 2 .
start-of-selection .
clear: wl_hours,
wl_minutes,
wl_seconds,
wl_hr_rem,
wl_min_rem,
wl_min,
wl_sec .
wl_hours = p_time div 3600.
wl_hr_rem = p_time mod 3600.
wl_minutes = wl_hr_rem div 60.
wl_min_rem = wl_hr_rem mod 60.
wl_seconds = wl_min_rem.
wl_sec = wl_seconds / 60.
wl_min = ( wl_minutes + wl_sec ) / 100.
if wl_min = '0.60'.
wl_hours = wl_hours + 1.
clear wl_min.
endif.
Regards
Raja
‎2006 Jan 03 7:36 AM
Hi pawan,
1. try this code (just copy paste)
2. On selection screen enter number of seconds.
it will give output in HH:MM:SS
REPORT abc.
*----
DATA : mytime(8) TYPE c.
PARAMETERS : begzt LIKE kako-begzt DEFAULT '45000'.
PERFORM gettime USING begzt CHANGING mytime.
WRITE 😕 mytime.
*----
FORM gettime USING sec CHANGING tm.
DATA : hh(2) TYPE n.
DATA : mm(2) TYPE n.
DATA : ss(2) TYPE n.
DATA :remsec(10) TYPE n.
hh = sec / 3600.
remsec = sec - ( 3600 * hh ).
mm = remsec / 60 .
remsec = sec - ( 60 * mm ).
ss = remsec.
CONCATENATE hh ':' mm ':' ss INTO tm.
ENDFORM. "gettime
regards,
amit m.
‎2006 Jan 03 7:47 AM
Hi Pawan,
1. MONI_TIME_CONVERT
This FM will solve your problem.
Regards,
Amit M.
‎2006 Jan 03 8:55 AM
Hi,
pls award points if any answers have been helpful.
regards,
amit m.