Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Hmm... any ideas on this?

Former Member
0 Kudos

Hi,

I have two fields

1. TIME (ex: 230000)

2. HOURS (ex: 7.5)

I need to convert the hours into this format 073000 and add it to the TIME. Any ideas on this?

Thanks

Gova

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Try this..



report zrich_0002
       no standard page heading.


data: time type sy-uzeit  value '230000'.
data: hours type p decimals 1 value '7.5'.

data: calc_time type sy-uzeit.

calc_time =  ( hours * 60 ) * 60.

write:/ calc_time.

time = time + calc_time.

write:/ time.

Regards,

Rich Heilman

3 REPLIES 3

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

Try this..



report zrich_0002
       no standard page heading.


data: time type sy-uzeit  value '230000'.
data: hours type p decimals 1 value '7.5'.

data: calc_time type sy-uzeit.

calc_time =  ( hours * 60 ) * 60.

write:/ calc_time.

time = time + calc_time.

write:/ time.

Regards,

Rich Heilman

0 Kudos

Rich,

Great. It works just fine. I also need to do it the reverse way.

i.e. I need to convert 073000 into 7.5? Any ideas?

Thanks

Gova

0 Kudos

Hi,

Pls try this...

data : wa_time type t value '073000'.

data : wa_p type p decimals 2.

wa_p = wa_time / 3600 .

write 😕 wa_p.

Thanks & Regards,

Renjith