‎2008 Jul 02 11:05 AM
hi
i am working with the function module spell_amount.
the outcome that i am getting is different when compared with the amount in words and figures
ex : amt is 1,800.00
in words : one hundred eighty thousand
‎2008 Jul 02 11:07 AM
check this code:
v_i_amount = tmp_amt.
call function 'HR_IN_CHG_INR_WRDS'
exporting
amt_in_num = v_i_amount
IMPORTING
AMT_IN_WORDS = amt_in_words
EXCEPTIONS
DATA_TYPE_MISMATCH = 1
OTHERS = 2.
if sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif..Ur FM
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
‎2008 Jul 02 11:19 AM
Assign your amount to character variable and see.
data : amnt(13) type c.
amnt = amount.
condense amnt.
pass this to your FM spell_amount
‎2008 Jul 02 11:21 AM
Hi,
Additionaly just past the CURRENCY as 'INR' & you will get the desired result. You can test this directly from Se37 itself.
Regards
Raju Chitale
‎2008 Jul 02 11:31 AM
Hi, try like this..
u should pass currency also along with the amount.
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
amount = amount
currency = v_waers
filler = space
language = sy-langu
IMPORTING
in_words = spell
EXCEPTIONS
not_found = 01
too_large = 02.
‎2008 Jul 02 12:23 PM
Hi,
I getting correct result.
Go to Se37 and execute the FM.
Thanks,
Sriram Ponna.
‎2008 Jul 02 12:25 PM
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
amount = val
currency = 'INR' <-----is this given ???
IMPORTING
in_words = var.