Sunday, December 26, 2010
Use function module SPELL_AMOUNT to convert an amount or number into words.


REPORT ZTEST_SPELL.
DATA:
      LANGU      LIKE SY-LANGU,
      CURRENCY   LIKE PAYR_FI-WAERS VALUE 'USD',
      AMOUNT     LIKE PAYR_FI-RWBTR VALUE '123456789.12',
      WA_SPELL   TYPE SPELL.

CALL FUNCTION 'SPELL_AMOUNT'
  EXPORTING
    AMOUNT    = AMOUNT
    CURRENCY  = CURRENCY
    FILLER    = SPACE
    LANGUAGE  = SY-LANGU
  IMPORTING
    IN_WORDS  = WA_SPELL
  EXCEPTIONS
    NOT_FOUND = 1
    TOO_LARGE = 2
    OTHERS    = 3.
IF SY-SUBRC EQ 0.
  DATA:FULL_IN_WORDS TYPE STRING.
  CONCATENATE WA_SPELL-WORD 'dollors' 'and' WA_SPELL-DECWORD 'cents'
  INTO FULL_IN_WORDS
  SEPARATED BY SPACE.
  WRITE FULL_IN_WORDS.
ENDIF.

1 comment:

  1. I wan not knowing this thing.
    Thanks a lot for wonderful knowledge contribution.

    ReplyDelete

Your useful comments, suggestions are appreciated.Your comments are moderated.

Followers

Contact Form

Name

Email *

Message *

Web Dynpro ABAP Book

An SAP Consultant

Follow US


Want to Contribute ?

If you are interested in writing about the new stuff you learn everyday while working, please write to the.sap.consultants@gmail.com.

Click on Contribution for more details.