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

Function module for converting amount to amount in words?????????

Former Member
0 Likes
8,898

Hi All,

As per the requirement i have to convert amount in indian rupees to words. Which is the function module should i use? I tried using "SPELL_AMOUNT". but it is not dislaying in the correct format. please help.

Rakesh

1 ACCEPTED SOLUTION
Read only

Vijay
Active Contributor
0 Likes
3,933

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.

regards

vijay

<b>plz dont forget to reward points if helpful</b>

6 REPLIES 6
Read only

Former Member
0 Likes
3,933

Function module HR_IN_CHG_INR_WRDS converts a number into words in lakhs, but as this is part of the HR module may not be available in your system.

Regards,

Nick

Read only

Vijay
Active Contributor
0 Likes
3,934

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.

regards

vijay

<b>plz dont forget to reward points if helpful</b>

Read only

Former Member
0 Likes
3,933

Hi

you can use the function module....

HR_IN_CHG_INR_WRDS

reward points if helpful,

thanks & regards,

venkatesh

Read only

Former Member
0 Likes
3,933

Use SPELL_AMOUNT for general values and

HR_IN_CHG_INR_WRDS for Currency related values..

Reward if useful

Regards

Prax

Read only

0 Likes
3,933

data: int_val type i,

cent_val type p decimals 2,

val type p decimals 2,

IN_WORDS like spell,

SPELL_VAL(255) type c,

SPELL_CENT(255) type c.

int_val = trunc( val ).

cent_val = ( val - int_val ) * 100.

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

AMOUNT = val

CURRENCY = 'USD'

LANGUAGE = SY-LANGU

IMPORTING

IN_WORDS = IN_WORDS.

SPELL_VAL = IN_WORDS-WORD.

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

AMOUNT = cent_val

CURRENCY = 'USD'

LANGUAGE = SY-LANGU

IMPORTING

IN_WORDS = IN_WORDS.

SPELL_CENT = IN_WORDS-WORD.

CONCATENATE SPELL_VAL ' DOLAR ' SPELL_CENT ' CENTS ' INTO SPELL_VAL.

Read only

shekhar_439
Explorer
0 Likes
3,933

Function Module For INR USD Currency Formatting?