‎2007 May 17 6:35 AM
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
‎2007 May 17 6:38 AM
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.
‎2007 May 17 6:37 AM
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.
‎2007 May 17 6:38 AM
‎2007 May 17 6:38 AM
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.
‎2007 May 17 7:02 AM
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
‎2007 May 17 9:27 AM
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