function zfm_dx_je.
*"----------------------------------------------------------------------
*"*"本地接口:
*" IMPORTING
*" REFERENCE(I_MONEY) TYPE BF_DMBTR
*" EXPORTING
*" REFERENCE(O_MONEY)
*"----------------------------------------------------------------------
data:
v_s00(2) value '零',
v_s01(2) value '壹',
v_s02(2) value '贰',
v_s03(2) value '叁',
v_s04(2) value '肆',
v_s05(2) value '伍',
v_s06(2) value '陆',
v_s07(2) value '柒',
v_s08(2) value '捌',
v_s09(2) value '玖',
v_w00(2) value '',
v_w01(2) value '拾',
v_w02(2) value '佰',
v_w03(2) value '仟',
v_w04(2) value '万',
v_w05(4) value '拾',
v_w06(4) value '佰',
v_w07(4) value '仟',
v_w08(2) value '亿',
v_w09(4) value '拾',
v_w10(4) value '佰',
v_w11(4) value '仟',
v_w12(4) value '万',
v_sy(2) value '元',
v_sj(2) value '角',
v_sf(2) value '分',
gv_fs(2) value '负',
v_amount(16),"将金额转换成字符型
v_len type i, "v_amount或out的长度
v_var(5),"v_s0,v_s1,...,v_w0,v_w1,...
v_num(2) type n, "每一位的数值
v_s_num(2),"v_s0,v_s1,...中的值
v_weight(2) type n, "权数
v_w_num(4),"v_w0,v_w1,...中的值
v_flag0 type i value 0, "是否输出'零',0不输出,1输出
v_n type i value 0,
v_index type sy-index,
gv_flag type char1. "正负标识
if i_money < 0.
gv_flag = 'X'. "负数标识
endif.
data(gv_money) = conv zjine( abs( i_money ) ) .
v_amount = gv_money.
clear o_money.
shift v_amount left deleting leading space.
shift v_amount left deleting leading '0'.
*-计算分-----------------------------------------
v_len = strlen( v_amount ).
v_len = v_len - 1.
v_num = v_amount+v_len(1).
if v_num <> '0'.
concatenate 'v_s' v_num into v_var.
write (v_var) to v_s_num.
concatenate v_s_num v_sf o_money into o_money.
endif.
*-计算角-----------------------------------------
v_len = strlen( v_amount ).
v_len = v_len - 2.
v_num = v_amount+v_len(1).
if v_num <> '0'.
concatenate 'v_s' v_num into v_var.
write (v_var) to v_s_num.
concatenate v_s_num v_sj o_money into o_money.
endif.
*-输出‘整’字-------------------------------------
if o_money = ' '.
concatenate '整' o_money into o_money.
endif.
*-计算整数---------------------------------------
v_len = strlen( v_amount ).
v_len = v_len - 3.
if v_len = 0.
exit.
endif.
v_amount = v_amount(v_len)." 整数部分
*-输出‘元’字-------------------------------------
concatenate v_sy o_money into o_money.
v_n = v_len - 1.
v_weight = 0.
do v_len times.
v_index = sy-index.
* 从个位开始
v_num = v_amount+v_n(1).
if v_num <> '0'.
concatenate 'v_s' v_num into v_var.
write (v_var) to v_s_num.
concatenate 'v_w' v_weight into v_var.
write (v_var) to v_w_num.
concatenate v_s_num v_w_num o_money into o_money.
v_flag0 = 1.
else.
if v_flag0 = 1.
concatenate 'v_s' v_num into v_var.
write (v_var) to v_s_num.
concatenate v_s_num o_money into o_money.
v_flag0 = 0.
endif.
if v_index = 5 and v_len > 5 and v_len < 9 .
concatenate '万' o_money into o_money.
elseif v_index = 9 and v_len > 9.
concatenate '亿' o_money into o_money.
endif.
* CASE SY-INDEX.
* WHEN 5.CONCATENATE '万' OUT INTO OUT.
* WHEN 9.CONCATENATE '亿' OUT INTO OUT.
* ENDCASE.
endif.
v_weight = v_weight + 1.
v_n = v_n - 1.
enddo.
*-删除个位可能出现'零'的情况-----------------
search o_money for '圆'.
if sy-subrc = 0.
v_n = sy-fdpos - 2.
if v_n >= 0.
if o_money+v_n(2) = v_s00.
v_len = strlen( o_money ).
concatenate o_money(v_n) o_money+sy-fdpos into o_money.
endif.
endif.
endif.
if gv_flag = 'X'.
o_money = gv_fs && o_money.
endif.
endfunction.