zoukankan      html  css  js  c++  java
  • 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. 
  • 相关阅读:
    笔记-迎难而上之Java基础进阶4
    笔记-迎难而上之Java基础进阶3
    笔记-迎难而上之Java基础进阶1
    7天学完Java基础之7/7
    Java学习笔记(3)--- 内部类,基本数据类型
    C++ 基础语法 快速复习笔记(3)---重载函数,多态,虚函数
    C++ 基础语法 快速复习笔记---面对对象编程(2)
    C++ 基础语法 快速复习笔记(1)
    堆与栈(heap and stack)在c/c++的应用(概念)
    Python爬虫入门教程 5-100 27270图片爬取
  • 原文地址:https://www.cnblogs.com/ricoo/p/10169703.html
Copyright © 2011-2022 走看看