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

Regarding function module spell_amount

Former Member
0 Likes
864

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

6 REPLIES 6
Read only

former_member156446
Active Contributor
0 Likes
757

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

Read only

Former Member
0 Likes
757

Assign your amount to character variable and see.

data : amnt(13) type c.

amnt = amount.

condense amnt.

pass this to your FM spell_amount

Read only

Former Member
0 Likes
757

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

Read only

Former Member
0 Likes
757

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.

Read only

Former Member
0 Likes
757

Hi,

I getting correct result.

Go to Se37 and execute the FM.

Thanks,

Sriram Ponna.

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
757

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

amount = val

currency = 'INR' <-----is this given ???

IMPORTING

in_words = var.