‎2009 Oct 13 7:53 PM
Hi,
Is there any function module to convert currency into words??
FYI, I know the function modules SPELL_AMOUNT and HR_IN_CHG_INR_WRDS are used for this.
But my requirement is little different.
My requirement goes something like this :
if the amount is $23.43 or Rs 23.43 then the words should come like this :
Twenty Three dollars and forty three cents or
Twenty Three ruppes and forty three paise.
Any kind of help will be really appreciated.
Regards
Abhinab Mishra
‎2009 Oct 14 3:54 AM
Hi,
<li>SPELL_AMOUNT is the right function module.
<li>Try the sample program.
Thanks
Venkat.OREPORT ztest.
DATA:langu LIKE sy-langu,
currency LIKE payr_fi-waers VALUE 'USD',
amount LIKE payr_fi-rwbtr VALUE '123456789.12'.
DATA:wa_spell TYPE spell.
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
amount = amount
currency = currency
filler = space
language = sy-langu
IMPORTING
in_words = wa_spell
EXCEPTIONS
not_found = 1
too_large = 2
OTHERS = 3.
IF sy-subrc EQ 0.
DATA:full_in_words TYPE string.
CONCATENATE wa_spell-word 'dollors' 'and' wa_spell-decword 'cents'
INTO full_in_words
SEPARATED BY space.
WRITE full_in_words.
ENDIF.
‎2009 Oct 13 8:05 PM
I don't think there is any FM which handles after decimals ...
Instead split the amount and call FM separately (two times) ...
‎2009 Oct 13 8:19 PM
‎2009 Oct 13 8:35 PM
The only way is to aplit your amount into two variables ..
split v_amount at ',' into v_f1 v_dec.
Now call FM 2 times passing the above variables ...
Concatenate both ....
‎2009 Oct 13 9:48 PM
Hi Abhinab Mishra,
Try this:
DATA: v_decimal(2) TYPE n,
v_decimales(6) TYPE c.
p_amount = p_amount * 100.
v_decimal = p_amount MOD 100.
p_amount = p_amount / 100.
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
amount = p_amount
currency = v_waers
language = sy-langu
IMPORTING
in_words = it_spell
EXCEPTIONS
not_found = 1
too_large = 2
OTHERS = 3.
CONCATENATE it_spell-word
'AND'
v_decimal
INTO p_total SEPARATED BY space.
Regards,
José
‎2009 Oct 14 3:54 AM
Hi,
<li>SPELL_AMOUNT is the right function module.
<li>Try the sample program.
Thanks
Venkat.OREPORT ztest.
DATA:langu LIKE sy-langu,
currency LIKE payr_fi-waers VALUE 'USD',
amount LIKE payr_fi-rwbtr VALUE '123456789.12'.
DATA:wa_spell TYPE spell.
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
amount = amount
currency = currency
filler = space
language = sy-langu
IMPORTING
in_words = wa_spell
EXCEPTIONS
not_found = 1
too_large = 2
OTHERS = 3.
IF sy-subrc EQ 0.
DATA:full_in_words TYPE string.
CONCATENATE wa_spell-word 'dollors' 'and' wa_spell-decword 'cents'
INTO full_in_words
SEPARATED BY space.
WRITE full_in_words.
ENDIF.
‎2009 Oct 14 4:42 AM
Hello Abhinav,
Please split your amount at '.', and put into two variables and call SPELL_AMOUNT FM two times for each.
after that just concatenate both variable and pass it to final amount field.
FM for displaying amount after decimal is not available.
Hope above will solve your problem.
Regards,
Sujeet