如何将数字值转换为数字字?

How to convert number value into numeral word?

我正在尝试检查是否有某个数字,例如7845,有任何千,百,或十,例如7845有7倍千,8倍百,4倍十

然后程序应该将次数转换为字符串:

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.

我写的代码会检查千万,因此会检查MOD 10000000 的值是否小于等于 9。是否有任何函数或代码用于 abap 转换数字转换成字母?

提前谢谢大家!

使用功能模块SPELL_AMOUNT。或者复制它去城里。

REPORT ZQUICK.
PARAMETERS p_amt type  p LENGTH 8 .
data l_in_words type spell.


call function 'SPELL_AMOUNT'
  EXPORTING
     amount    = p_amt        " Amount/Number to Be Spelled Out
*    currency  = space    " Currency for Amounts, Blank for Numbers
*    filler    = space    " Filler for Padding the Output Field
*    language  = SY-LANGU " Language Indicator
 IMPORTING
     in_words  = l_in_words. " 

write : l_in_words-word.

您可以使用功能模块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 包含您需要的内容。