其他分享
首页 > 其他分享> > ABPA-SMARTFORMS金额数字转中文汉字大写

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

作者:互联网

直接上步骤:

  1.事务码:SE37创建函数

 

 

  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.运行效果

 

 

标签:CONCATENATE,SMARTFORMS,word,amount1,spell,大写,decword,ABPA,INTO
来源: https://www.cnblogs.com/1502762920-com/p/15762952.html