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

Displaying Numbers in Text Format

Former Member
0 Likes
1,238

Hi all,

Im tryin to display numbers in text format.

eg: 151 should be displayed as "One Hundred and Fifty One.

Is dhere any function module for the same.

Thnx,

pk

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,050

Hello,

Use the FM SPELL_AMOUNT

Cheers,

Vasanth

4 REPLIES 4
Read only

Former Member
0 Likes
1,051

Hello,

Use the FM SPELL_AMOUNT

Cheers,

Vasanth

Read only

Former Member
0 Likes
1,050

Hi,

Check the following program:

REPORT ZSPELL.

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

Read only

Former Member
0 Likes
1,050

Hi prashanth kishan,

See this example code

data w_word type SPELL.

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

AMOUNT = 123

CURRENCY = ' '

FILLER = ' '

LANGUAGE = SY-LANGU

IMPORTING

IN_WORDS = w_word

EXCEPTIONS

NOT_FOUND = 1

TOO_LARGE = 2

OTHERS = 3

.

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 / w_word-WORD.

<REMOVED BY MODERATOR>

Mahi.

Edited by: Alvaro Tejada Galindo on Feb 19, 2008 5:32 PM

Read only

Former Member
0 Likes
1,050

Hi Prashanth ,

You can use the " SPELL_AMOUNT " FM.

But for the Amount ,the value should be 151.00 (eg) irrespective of the currency mode you choose.

You have to specify the decimal part also.

Regards,

Chitra