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

SPELL_AMOUNT

Former Member
0 Likes
829

HI,

Can any one help me with following code.? Please fix the errors in the code.

DATA : MONEY TYPE I,

VALUE LIKE SY-WAERS,

LANG LIKE SY-LANGU,

IN_LETTERS LIKE SPELL.

MONEY = 1000.

CALL FUNCTION 'SPELL AMOUNT'

EXPORTING

AMOUNT = MONEY

IMPORTING

IN_WORDS = IN_LETTERS

EXCEPTIONS

NOT_FOUND = 1

TOO_LARGE = 2

OTHERS = 3

IF SY-SUBRC <> 0

ENDIF.

WRITE : / AMOUNT, VALUE, IN_LETTERS.

7 REPLIES 7
Read only

Former Member
0 Likes
752

I guess data type for MONEY should be N.

Please check and confirm.

Regards,

Amey

Read only

Former Member
0 Likes
752

Hi,

Check this..

DATA : money TYPE p DECIMALS 2,

in_letters LIKE spell.

money = '1000.00'.

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

amount = money

IMPORTING

in_words = in_letters

EXCEPTIONS

not_found = 1

too_large = 2

OTHERS = 3.

WRITE : / in_letters-WORD.

Thanks,

Naren

Read only

ferry_lianto
Active Contributor
0 Likes
752

Hi,

Please try this.


DATA: MONEY LIKE PAYR-RWBTR,
      VALUE LIKE SY-WAERS,
      LANG  LIKE SY-LANGU,
      IN_LETTERS LIKE SPELL.
                                                                        
MONEY = 1000.
VALUE = SY-WAERS.
LANG = SY-LANGU.
                                                                        
CALL FUNCTION 'SPELL_AMOUNT'
  EXPORTING
    AMOUNT    = MONEY
    CURRENCY  = VALUE
    LANGUAGE  = LANG
  IMPORTING
    IN_WORDS  = IN_LETTERS
  EXCEPTIONS
    NOT_FOUND = 1
    TOO_LARGE = 2
    OTHERS    = 3.
                                                                        
WRITE : / MONEY, VALUE, IN_LETTERS-WORD.

Regards,

Ferry Lianto

Read only

0 Likes
752

The output I am getting is One Thousand.

I would like to have output as One thousand dollars.

VALUE = SY-WAERS.

Read only

0 Likes
752

The output I am getting is One Thousand.

I would like to have output as One thousand dollars.

VALUE = SY-WAERS. What does this statement do

Read only

Former Member
0 Likes
752

Try:


DATA : money TYPE i,
value LIKE sy-waers,
lang LIKE sy-langu,
in_letters LIKE spell.

money = 1000.
CALL FUNCTION 'SPELL_AMOUNT'
  EXPORTING
    amount    = money
  IMPORTING
    in_words  = in_letters
  EXCEPTIONS
    not_found = 1
    too_large = 2
    OTHERS    = 3.
IF sy-subrc <> 0.
ENDIF.

WRITE : / money, value, in_letters-word.

Rob

Read only

jayanthi_jayaraman
Active Contributor
0 Likes
752

Hi,

Try this code.Now it is not showing any error.Reward points by clicking the star on the left of reply,if it helps.

DATA : MONEY TYPE I,

VALUE LIKE SY-WAERS,

LANG LIKE SY-LANGU,

IN_LETTERS TYPE SPELL.

MONEY = 1000.

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

AMOUNT = MONEY

IMPORTING

IN_WORDS = IN_LETTERS

EXCEPTIONS

NOT_FOUND = 1

TOO_LARGE = 2

OTHERS = 3<b>.</b>

IF SY-SUBRC <> 0<b>.</b>

ENDIF.

WRITE : / <b>MONEY</b>, VALUE, <b>IN_LETTERS-word</b>.