Application Development and Automation 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: 
Read only

Function Module for time in words

Former Member
0 Likes
825

Hi all,

My Requirement is to print the time ie hours and minutes in words in the Smartform. Could you all help me out to find the function module name for which i can pass the sy-uzeit and get the same in words.

Eg: 12:25:00

This should be printed as: tewelve hrs and twenty five minutes.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
780

Hi sudhakar

there is no Fm for you need but you can write your own fm

like this

data: mytime type t, hour(2) type c,min(2) type c, sec(2) type c.

data: word(10) type c, compword(50) type c.

mytime = '12:25:00'

hour = mytime+0(2).

min = mytime+3(2).

sec = mytime+6(2).

perform getword using hour changing word.

concatenate compword word 'hour and ' into compword.

perform getword using min changing word.

concatenate compword word 'minutes and ' into compword.

perform getword using sec changing word.

concatenate compword word ' seconds' into compword.

write: compword.

form getword using time1(2) type c changing word(10) type c.

case time1.

when '0'.

word = 'zero'.

when '1'.

word = 'one'........upto sixty.

endform.

regards

kishore

5 REPLIES 5
Read only

Former Member
0 Likes
780

I am not sure there is any standard FM avaiable to full fill your requirement. THe best way to write custom FM by refer to "SPELL_AMOUNT" FM.

Read only

Former Member
0 Likes
781

Hi sudhakar

there is no Fm for you need but you can write your own fm

like this

data: mytime type t, hour(2) type c,min(2) type c, sec(2) type c.

data: word(10) type c, compword(50) type c.

mytime = '12:25:00'

hour = mytime+0(2).

min = mytime+3(2).

sec = mytime+6(2).

perform getword using hour changing word.

concatenate compword word 'hour and ' into compword.

perform getword using min changing word.

concatenate compword word 'minutes and ' into compword.

perform getword using sec changing word.

concatenate compword word ' seconds' into compword.

write: compword.

form getword using time1(2) type c changing word(10) type c.

case time1.

when '0'.

word = 'zero'.

when '1'.

word = 'one'........upto sixty.

endform.

regards

kishore

Read only

0 Likes
780

Hi Hari,

Thanks a lot for the solution and I have created a function module and its working fine.

And I have not forgotten you to reward you ther points. Thanks a lot.

Read only

Former Member
0 Likes
780

Thanks for your replys are there any helpful answers

Read only

0 Likes
780

Hi Sudhakar,

I dont see any Function Module for this.You need to write a code for this,which seems to be laborious.