ABPA-SMARTFORMS金额数字转中文汉字大写

直接上步骤:

  1.事务码:SE37创建函数

ABPA-SMARTFORMS金额数字转中文汉字大写

 

ABPA-SMARTFORMS金额数字转中文汉字大写

 

  2.函数代码

FUNCTION ZXXXX.
*"----------------------------------------------------------------------
*"*"本地接口:
*"  IMPORTING
*"     REFERENCE(AMOUNT)
*"  EXPORTING
*"     REFERENCE(E_OUTPUT)
*"----------------------------------------------------------------------
  DATA: spell TYPE spell.
  DATA: sdlen TYPE i.
  DATA: amount1 TYPE p DECIMALS 2.
  DATA: flag TYPE c.
  amount1 = amount.
  IF amount1 < 0.
    amount1 = 0 - amount1.
    flag = '负'.
  ELSE.
    flag = ''.
  ENDIF.

  CALL FUNCTION 'SPELL_AMOUNT'
    EXPORTING
      amount    = amount1
      currency  = 'CNY'
      filler    = ''
      language  = '1'
    IMPORTING
      in_words  = spell
    EXCEPTIONS
      not_found = 1
      too_large = 2
      OTHERS    = 3.
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.

  IF spell-decword <> '零'.
    sdlen = strlen( spell-decword ).
    CASE sdlen.
      WHEN '1'.
        CONCATENATE '零' spell-decword '分' INTO spell-decword.
      WHEN '2'.
        REPLACE '拾' IN spell-decword WITH '角'.
      WHEN '3'.
        REPLACE '拾' IN spell-decword WITH '角'.
        CONCATENATE spell-decword '分' INTO spell-decword.
    ENDCASE.
    CONCATENATE spell-word '元' spell-decword INTO spell-word.
  ELSE.
    CONCATENATE spell-word '元整' INTO spell-word.
  ENDIF.
  CONCATENATE flag spell-word INTO spell-word.
  e_output = spell-word.
ENDFUNCTION.

  3.运行效果

ABPA-SMARTFORMS金额数字转中文汉字大写

 

ABPA-SMARTFORMS金额数字转中文汉字大写

 

上一篇:10. MySQL数据类型


下一篇:MySQL—— 12 Mysql数据类型