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

converting amount into words

Former Member
0 Likes
2,552

hi all,

i want to convert amount value(netwr) which is numeric into words.

eg.

2,500 as two thousand five hundred.

can any body send me sample code for this, or any functional module for this.

thanks

venkat

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,064

hi Venkat,

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.

hi Venkat,

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.

8 REPLIES 8
Read only

Former Member
0 Likes
2,065

hi Venkat,

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.

Read only

Former Member
0 Likes
2,064

Hi

use the function modules

<b>SPELL_AMOUNT or

FM HR_IN_CHG_INR_WRDS</b>

search for where used list of them you will get lot of sample codes

Reward points if useful

Regards

Anji

Read only

Former Member
0 Likes
2,064

Hi,

Use FM SPELL_AMOUNT You will get your requirement.

Thanks

Ravi

Read only

Former Member
0 Likes
2,064

Hi,

Try this Function Module,

TABLES SPELL.

DATA : T_SPELL LIKE SPELL OCCURS 0 WITH HEADER LINE.

DATA : PAMOUNT LIKE SPELL-NUMBER VALUE '123'.

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.

Thanks.

Reward if helpful.

Read only

0 Likes
2,064

This message was moderated.

Read only

0 Likes
2,064

hi,

use the Fm SPELL_AMOUNT .

regards,

santosh

Read only

Former Member
0 Likes
2,064

Hi,

Use the below function module SPELL_AMOUNT

Regards

Sudheer

Read only

Former Member
0 Likes
2,064

This message was moderated.