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: 

function module to convert currency in words.

Former Member
0 Kudos

Hi Experts,

I want to know the function module to convert currency in words.please give me function module name.

Regards,

Siva

6 REPLIES 6

Former Member
0 Kudos

SPELL_AMOUNT

Former Member
0 Kudos

for example currency 'INR' function module should return 'Indian currency'

0 Kudos

Hi Siva,

Write the following Code..

Select LTEXT 
    INTO W_LTEXT
   FROM TCURC
   WHERE WAERS = W_WAERS.

If Found Help Full Do Reward.

Regards.

Eshwar.

Former Member
0 Kudos

Hi,

Check the following code:

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

Regards,

Bhaskar

Former Member
0 Kudos

Hi,

Function module SPELL_AMOUNT converts an amount or number into words. It can be used as follows:

1. Convert a number into words

To do this, the transfer parameters LANGUAGE and AMOUNT have to be entered.

2. Convert an amount into words

To do this, the fields LANGUAGE, CURRENCY, and AMOUNT have to be entered.

3. Set the number of places before and after the decimal point for an amount

To do this, the parameters CURRENCY and AMOUNT have to be entered. The LANGUAGE field must be transferred with the value SPACE! This option optimizes the runtime of the function module.

The structure SPELL transfers the converted amounts. The FB enters the number of places before and after the decimal point in the NUMBER and DECIMAL fields, the amount in words in the WORD and DECWORD fields, and the figure in words in the DIGnn fields. The numbers converted into words can be protected by a star or some other FILLER.

Check this link,problem will be solved-

Regards,

Sujit

Former Member
0 Kudos

Hi

Use FM HR_IN_CHG_INR_WRDS or SPELL_AMOUNT

Here is the sample code

DATA AMT_IN_NUM LIKE PC207-BETRG.
DATA AMT_IN_WORDS(100) TYPE c.
 
PARAMETERS: AMOUNT LIKE AMT_IN_NUM.
 
CALL FUNCTION 'HR_IN_CHG_INR_WRDS'
EXPORTING
amt_in_num = 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.
WRITE AMT_IN_WORDS.

With Regards

Nikunj Shah