ABAP-金额小写转大写

FUNCTION ZSDI0007_CH_LOWERTOUPPER.
*"----------------------------------------------------------------------
*"*"Local interface:
*"  IMPORTING
*"     REFERENCE(I_JE) TYPE  DMBTR
*"  EXPORTING
*"     VALUE(E_JE) TYPE  CHAR50
*"----------------------------------------------------------------------

*&---------------------------------------------------------------------*
**RFC name: ZSDI0007_CH_LOWERTOUPPER
**Description: 金额小写转大写
**Date/Author: 2013.08.06/rico
**Program Logic:
**1.call function 'SPELL_AMOUNT'
***********************************************************************
** M O D I F I C A T I O N  L O G
***********************************************************************
** ChangeDate  Programmer   Request         Description
** ==========  ==========   ============   ============================
** 2013-08-06   rico        DEVK900071     Created
*&---------------------------------------------------------------------*

data:s_zs type spell,
     s_j  type spell,
     s_f  type spell,
     v_nu type char30,
     v_zs type char30,
     v_xs type char30,
     v_j  type char30,
     v_f  type char30.

  v_nu = i_je.

  split v_nu at '.' into v_zs v_xs.
  v_j = v_xs(1).
  v_f = v_xs+1(1).

if v_zs <> '0' .
   call function 'SPELL_AMOUNT'
     exporting
       language '1'   "sy-langu
       currency = sy-waers
       amount   = v_zs
       filler   ' '
     importing
       in_words = s_zs.
endif.


call function 'SPELL_AMOUNT'
  exporting
    language '1'   "sy-langu
    currency = sy-waers
    amount   = v_j
    filler   ' '
  importing
    in_words = s_j.


if v_f <> '0' .
   call function 'SPELL_AMOUNT'
     exporting
       language '1'   "sy-langu
       currency = sy-waers
       amount   = v_f
       filler   ' '
     importing
       in_words = s_f.
endif.

if s_j-word = '' and s_f is initial .          "如果没有小数位数 如 11.00
   concatenate s_zs-word '元整' into e_je.
elseif s_zs is initial .                        "如果没有证书位 如 0.10 0.01 0.11
   if s_j-word <> '' .
      concatenate s_j-word '' into e_je .
   endif.
   if s_f is not initial.
      concatenate e_je s_f-word '' into e_je.
   endif.
else.                                           "如果整数小数位都有 如 11.01  11.10 11.11
   concatenate s_zs-word '' into e_je.

   if s_j-word = '' and s_f is not initial .
      concatenate e_je s_j-word into e_je.
   else.
      concatenate e_je s_j-word '' into e_je .
   endif.

   if s_f is not initial .
      concatenate e_je s_f-word '' into e_je.
   endif.

endif.

ENDFUNCTION. 
原文地址:https://www.cnblogs.com/ricoo/p/10169703.html