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

code

Former Member
0 Likes
746

Hi,

i have to write a program in which the user enters any digit between 1 and 99 and the output is displayed in words.

please help me in writing the code and explain the code in efficient manner.

regards

vivek

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
722

Hi vivek,

Try this function module.

TABLES SPELL.

DATA : T_SPELL LIKE SPELL OCCURS 0 WITH HEADER LINE.

DATA : PAMOUNT LIKE SPELL-NUMBER VALUE '99'.

SY-TITLE = 'SPELLING NUMBER'.

PERFORM SPELL_AMOUNT USING PAMOUNT 'USD'.

WRITE: 'NUMBERS', T_SPELL-WORD, 'DECIMALS ', T_SPELL-DECWORD.

FORM SPELL_AMOUNT USING PWRBTR PWAERS.

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

AMOUNT = PAMOUNT

CURRENCY = PWAERS

FILLER = SPACE

LANGUAGE = 'E'

IMPORTING

IN_WORDS = T_SPELL

EXCEPTIONS

NOT_FOUND = 1

TOO_LARGE = 2

OTHERS = 3.

ENDFORM.

Thanks.

Reward if Helpful.

5 REPLIES 5
Read only

rahulkavuri
Active Contributor
0 Likes
722

check this out, its working

REPORT ZURL NO STANDARD PAGE HEADING.

parameter: number type int2. "this will be two digit number

data: words like SPELL.

*now use the FM SPELL_AMOUNT

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

LANGUAGE = SY-LANGU

  • CURRENCY = T001-WAERS

AMOUNT = number

FILLER = SPACE

IMPORTING

IN_WORDS = WORDS

EXCEPTIONS

NOT_FOUND = 1

TOO_LARGE = 2.

data: string(35).

string = words.

WRITE string.

Read only

Former Member
0 Likes
722

hi use the function module

spell_amount....

Read only

Former Member
0 Likes
723

Hi vivek,

Try this function module.

TABLES SPELL.

DATA : T_SPELL LIKE SPELL OCCURS 0 WITH HEADER LINE.

DATA : PAMOUNT LIKE SPELL-NUMBER VALUE '99'.

SY-TITLE = 'SPELLING NUMBER'.

PERFORM SPELL_AMOUNT USING PAMOUNT 'USD'.

WRITE: 'NUMBERS', T_SPELL-WORD, 'DECIMALS ', T_SPELL-DECWORD.

FORM SPELL_AMOUNT USING PWRBTR PWAERS.

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

AMOUNT = PAMOUNT

CURRENCY = PWAERS

FILLER = SPACE

LANGUAGE = 'E'

IMPORTING

IN_WORDS = T_SPELL

EXCEPTIONS

NOT_FOUND = 1

TOO_LARGE = 2

OTHERS = 3.

ENDFORM.

Thanks.

Reward if Helpful.

Read only

Former Member
0 Likes
722

Vivek,

Check this FM HR_IN_CHG_INR_WRDS also. but this will add Rupees in the end.

say if you give 10, then output will be ten rupees.

Regards

Vijay

Read only

Former Member
0 Likes
722

Hi,

Check the following code:

REPORT ZSPELL.

TABLES SPELL.

DATA : T_SPELL LIKE SPELL OCCURS 0 WITH HEADER LINE.

DATA : PAMOUNT LIKE SPELL-NUMBER VALUE '1234510'.

SY-TITLE = 'SPELLING NUMBER'.

PERFORM SPELL_AMOUNT USING PAMOUNT 'USD'.

WRITE: 'NUMBERS', T_SPELL-WORD, 'DECIMALS ', T_SPELL-DECWORD.

FORM SPELL_AMOUNT USING PWRBTR PWAERS.

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

AMOUNT = PAMOUNT

CURRENCY = PWAERS

FILLER = SPACE

LANGUAGE = 'E'

IMPORTING

IN_WORDS = T_SPELL

EXCEPTIONS

NOT_FOUND = 1

TOO_LARGE = 2

OTHERS = 3.

ENDFORM. " SPELL_AMOUNT

Hope this helps.

Reward if helpful.

Regards,

Sipra