Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Using "SPELL AMOUNT" function to convert amounts in ABAP
You can use the standard function module SPELL_AMOUNT in ABAP to convert numeric amounts into their corresponding word representations. This is particularly useful for financial documents, checks, and reports where amounts need to be displayed in written form.
To access and explore this function module, use Transaction code SE37 (Function Builder) ?
Click on the Search icon and select Function module SPELL_AMOUNT ?
Key Parameters
The SPELL_AMOUNT function module accepts several important parameters ?
- AMOUNT ? The numeric amount to be converted
- CURRENCY ? The currency code (e.g., USD, EUR, INR)
- LANGUAGE ? The language for text conversion (e.g., EN, DE, FR)
- IN_WORDS ? The output parameter containing the amount in words
Example
Here's how to use the SPELL_AMOUNT function module in your ABAP code ?
DATA: lv_amount TYPE p DECIMALS 2 VALUE '1234.56',
lv_currency TYPE waers VALUE 'USD',
lv_language TYPE sy-langu VALUE 'E',
lv_in_words TYPE spell.
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
amount = lv_amount
currency = lv_currency
language = lv_language
IMPORTING
in_words = lv_in_words.
WRITE: / 'Amount:', lv_amount, lv_currency,
/ 'In Words:', lv_in_words.
The output would display the numeric amount followed by its textual representation, such as "One Thousand Two Hundred Thirty Four and 56/100 Dollars".
Conclusion
The SPELL_AMOUNT function module provides a standardized way to convert numeric amounts into written words, supporting multiple currencies and languages for international business applications.
