I am trying to check if a certain number, e.g. 7845, has any thousands, hundred, or tens, e.g. 7845 has 7 times thousands, 8 times hundreds, 4 times tens. The program is supposed to then convert the amount of times to a string. For that I have tried the following code:
IF ( DMBTR MOD 10000000 ) LE 9.
DMBTR / 10000000 = lv_tenmillions.
lv_tenmillions_check = lv_tenmillions MOD 1.
IF lv_tenmillions_check > 0.
"Convert
ENDIF.
IF lv_tenmillions_check < 0.
"ZERO
ENDIF.
ENDIF.
The code that I have written would check for tenmillions, thus would check if the MOD of a value with 10000000 is less equal to 9. Is there any function or code that is used in abap to convert the number into letters?
Thank you all in advance!
>Solution :
You can use function module SPELL_AMOUNT:
DATA: lv_spell TYPE spell.
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
amount = 123
* CURRENCY = ' '
* FILLER = ' '
* LANGUAGE = SY-LANGU
IMPORTING
in_words = lv_spell
EXCEPTIONS
not_found = 1
too_large = 2
OTHERS = 3.
lv_spell-word contains what you need.