Help on Conversion From Numbers to Text Amount

Is there any SAP function that could turn the numbers to text amount?

For example:

I need to change USD 3789.45 to USD Three Thousand Seven Hundred Eighty Night and Fourty Five Cents.

Here I am giving some little bit code for conversion, please go through it.

Define internal table selected fields

DATA: BEGIN OF it_header OCCURS 0,
                 vbeln  LIKE  vbrk-vbeln,      "Billing Document
                waerk  LIKE  vbrk-waerk,      "SD document currency
                fkdat  LIKE  vbrk-fkdat,      "Billing date for billing index
                kunag  LIKE  vbrk-kunag,      "Sold-to party
             END OF it_header.

Define variables 

v_netvalue TYPE vbrp-netwr.
it_spell LIKE spell OCCURS 1 WITH HEADER LINE.

Assign into function module

CALL FUNCTION 'SPELL_AMOUNT'
 EXPORTING
   amount          = v_netvalue
   currency        = it_header-waerk
   language        = sy-langu
 IMPORTING
   in_words        = it_spell.

Or

This sample program shows how to work spell amount function module with decimals:

REPORT ZDEC_TEST.

DATA: langu      LIKE sy-langu,
           currency   LIKE payr_fi-waers VALUE 'USD',
           amount     LIKE payr_fi-rwbtr VALUE '987654321.12'.

DATA:cu_spell   TYPE spell.

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING
    amount    = amount
    currency  = currency
    filler    = space
    language  = sy-langu

IMPORTING
   in_words  = cu_spell

EXCEPTIONS
   not_found = 1
   too_large = 2

OTHERS    = 3.

IF sy-subrc EQ 0.

DATA:in_words TYPE string.

CONCATENATE cu_spell-word 'dollors' 'and' cu_spell-decword 'cents'
     INTO in_words
      SEPARATED BY space.

  WRITE in_words.

ENDIF.

--> End of ABAP Example

ABAP

See Also:
Function Module to Make Help on Your Field

Tables
Database Table

ABAP Books List
ABAP/4 Certification, Programming, Smartforms, Sapscripts and Object Oriented Programming Books

Smart Forms
SAP Smartforms

ABAP Menu:
ABAP Example Hints and Tips

Return to Index:-
SAP ABAP/4 Programming, Basis Administration, Configuration Hints and Tips

(c) www.gotothings.com All material on this site is Copyright.
Every effort is made to ensure the content integrity.  Information used on this site is at your own risk.
All product names are trademarks of their respective companies.  The site www.gotothings.com is in no way affiliated with SAP AG.
Any unauthorised copying or mirroring is prohibited.