Application Development 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: 

Covert INR into words

Former Member
0 Kudos
464

hi all,

I want convert the INR into words.

ex: 1,23,456.00 - one lac twenty three thousands four hundred fifty six only.

but using SPELL_AMOUNT FM.

it converting one hundred twenty-three thousand four hundred fifty-six.

can anyone suggest me.

thanx.

srinivas.

6 REPLIES 6

Former Member
0 Kudos
132

Hi Srinivas,

If you look at the documentation of the Function Module, it tells you that the table T015Z has to be customized for your language if the default format of the spelled amounts is not acceptable.

Unfortunately, the vales are stored only based on the language, and not on the currency. So If you configure the table for the English language, then all users who log on in English will get the same format (LAKHS, CRORES etc.,). This may not be acceptable for users in a country like US where the format preferred might be MILLIONS , BILLIONS etc.,

Please exercise caution before going ahead with configuring the table.

The only other alternative (to modifying the table) that I can think of will be to write your own function module!!

Please let us know your approach.

Regards,

Anand Mandalika.

0 Kudos
132

Hi Anand,

Can you explain what fo you mean by configure

T015Z by writing function module?

Regards,

Dilip

jayanthi_jayaraman
Active Contributor
0 Kudos
132

Hi,

Check these links.

Former Member
0 Kudos
132

FUNCTION Z_FI_AMT_WRDS_CONVERT .

*"----


""Local interface:

*" IMPORTING

*" REFERENCE(AMT)

*" EXPORTING

*" REFERENCE(WORD) TYPE SPELL-WORD

*"----


amt_c1 = amt.

replace '.' with 'D' into amt_c1.

SEARCH amt_c1 for 'D'.

IF sy-subrc = 0.

amt_wh1 = amt_c1+0(sy-fdpos).

wrk_fdpos = sy-fdpos + 1.

amt_dc1 = amt_c1+wrk_fdpos(2).

ELSE.

amt_wh1 = amt_c1.

amt_dc1 = '00'.

ENDIF.

amtnmr = amt_wh1.

amtdec = amt_dc1.

CONCATENATE amtnmr amtdec INTO amount.

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

amount = amount

currency = 'INR'

filler = ' '

language = 'E'

IMPORTING

in_words = amountrs.

*WRITE: / 'amount in figures: ' ,'Rs.-->', AMTNMR,'.',AMTDEC.

*WRITE: / 'Amount in WORDS.: ' ,' Rs.' ,AMOUNTRS-WORD,

*'AND' ,AMOUNTRS-DECWORD ,'Paisa Only'.

*SKIP.

CLEAR: unit1,digit1,unit2,digit2,unit3,digit3,unit4,digit4,word1,word2,

word3,word4,word.

digit1 = amtnmr+14.

unit1 = amtnmr+13.

digit2 = amtnmr+12.

unit2 = '0'.

digit3 = amtnmr+11.

unit3 = amtnmr+10.

digit4 = amtnmr+9.

unit4 = amtnmr+8.

digit5 = amtnmr+7.

unit5 = amtnmr+6.

digit6 = amtnmr+5.

unit6 = '0'.

digit7 = amtnmr+4.

unit7 = amtnmr+3.

digit8 = amtnmr+2.

unit8 = amtnmr+1.

digit9 = amtnmr.

unit9 = '0'.

*WRITE:/ 'UNIT9 = ' , UNIT9, 'DIGIT9 = ', DIGIT9.

IF ( unit1 NE '0' ) OR ( digit1 NE '0' ).

SELECT SINGLE wort INTO word1 FROM t015z WHERE einh = unit1

AND ziff = digit1 AND spras = 'E'.

  • word1 = t015z-wort.

REPLACE ';' WITH '' INTO word1.

*write: / word1.

ENDIF.

IF unit2 NE '0' OR digit2 NE '0'.

SELECT SINGLE * FROM t015z WHERE einh = unit2

AND ziff = digit2 AND spras = 'E'.

word2 = t015z-wort.

REPLACE ';' WITH '' INTO word2.

CONCATENATE word2 ' HUNDRED ' INTO word2.

*REPLACE '(FEMININE)' WITH '' INTO WORD2.

*write: / word2.

ENDIF.

IF unit3 NE '0' OR digit3 NE '0'.

SELECT SINGLE * FROM t015z WHERE einh = unit3

AND ziff = digit3 AND spras = 'E'.

word3 = t015z-wort .

CONCATENATE word3 ' THOUSAND ' INTO word3.

REPLACE ';' WITH '' INTO word3.

*write: / word3.

ENDIF.

IF unit4 NE '0' OR digit4 NE '0'.

SELECT SINGLE * FROM t015z WHERE einh = unit4

AND ziff = digit4 AND spras = 'E'.

word4 = t015z-wort.

REPLACE ';' WITH '' INTO word4.

CONCATENATE word4 ' LAKH ' INTO word4.

*WRITE: / WORD4.

ENDIF.

IF unit5 NE '0' OR digit5 NE '0'.

SELECT SINGLE * FROM t015z WHERE einh = unit5

AND ziff = digit5 AND spras = 'E'.

word5 = t015z-wort.

REPLACE ';' WITH '' INTO word5.

*write: / word5.

ENDIF.

IF unit6 NE '0' OR digit6 NE '0'.

*UNIT6 = 'H'.

SELECT SINGLE * FROM t015z WHERE einh = unit6

AND ziff = digit6 AND spras = 'E'.

word6 = t015z-wort.

REPLACE ';' WITH ' ' INTO word6.

CONCATENATE word6 ' HUNDRED ' INTO word6.

*REPLACE '(FEMININE)' WITH '' INTO WORD6.

*write: / word6.

ENDIF.

IF unit7 NE '0' OR digit7 NE '0'.

SELECT SINGLE * FROM t015z WHERE einh = unit7

AND ziff = digit7 AND spras = 'E'.

word7 = t015z-wort.

REPLACE ';' WITH ' ' INTO word7.

CONCATENATE word7 ' THOUSAND ' INTO word7.

*write: / word7.

ENDIF.

IF unit8 NE '0' OR digit8 NE '0'.

SELECT SINGLE * FROM t015z WHERE einh = unit8

AND ziff = digit8 AND spras = 'E'.

word8 = t015z-wort.

REPLACE ';' WITH '' INTO word8.

CONCATENATE word8 ' LAKHS ' INTO word8.

*write: / word8.

ENDIF.

IF digit9 NE '0'.

unit9 = '0'.

SELECT SINGLE * FROM t015z WHERE einh = unit9

AND ziff = digit9 AND spras = 'E'.

word9 = t015z-wort.

REPLACE ';' WITH ' ' INTO word9.

*REPLACE '(FEMININE)' WITH ' ' INTO WORD9.

CONCATENATE word9 ' HUNDRED ' INTO word9.

ENDIF.

CONCATENATE word9 word8 word7 word6 word5 ' CRORE ' INTO wordc

SEPARATED BY space.

*WRITE:/ 'Amount in Rs.------->'.

IF amountrs-decword NE 'ZERO'.

CONCATENATE ' AND PAISE ' amountrs-decword INTO dcwrd

SEPARATED BY space.

ENDIF.

IF amtnmr > 9999999.

*WRITE: / WORDC.

*ENDIF.

CONCATENATE 'RUPEES' wordc word4 word3 word2 word1 dcwrd 'ONLY'

INTO word SEPARATED BY space.

ELSE.

CONCATENATE 'RUPEES'word4 word3 word2 word1 dcwrd 'ONLY'

INTO word SEPARATED BY space.

ENDIF.

CLEAR dcwrd.

*WRITE 😕 WORD.

*WRITE: 'AND' ,AMOUNTRS-DECWORD ,'Paise Only

ENDFUNCTION.

Regards,

Deva.

0 Kudos
132

Even if u were to write ur own logic, i think u shdnt hard code "Paisa".... unless u r very very sure that ur currency is always going to be in INR.

Lakshmant1
Active Contributor
0 Kudos
132

Hi Srinivas,

Check HR_IN_CHG_INR_WRDS function Module.

Thanks

Lakshman