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

发布于 2025-01-09 00:06:06 字数 459 浏览 1 评论 0原文

我正在尝试检查某个数字(例如 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.

我编写的代码将检查一千万,因此将检查 10000000 的值的 MOD 是否小于 9。是否有任何函数或代码可以abap中用于将数字转换为字母?

提前谢谢大家!

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:

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

最笨的告白 2025-01-16 00:06:06

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

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.

情定在深秋 2025-01-16 00:06:06

使用功能模块 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.

use the functional module SPELL_AMOUNT. Or copy it and go to town.

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.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文