本文主要是介绍打印 金额字段千分符设置 金额字段中文大写,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
方法: SPELL_AMOUNT 可以设置千分符
使用write to语句参照一个金额字段
DATA: l_vrkme TYPE lips-VRKME VALUE 'ST'.WRITE ls_form-hsl to ls_item-shslcurrency l_vrkme RIGHT-JUSTIFIED .
函数 SPELL_AMOUNT 可以把金额转换成中文大写形式,需要手工取判断 ‘元’,‘角’,‘分’
DATA: GV_TOTAL(10) TYPE P DECIMALS 2 VALUE '1234567.89',GV_AMOUNT TYPE CHAR20,LV_INT TYPE CHAR10, "整数部分LV_DEC TYPE CHAR5, "小数部分LV_CENT_INT TYPE CHAR5, "角LV_CENT_DEC TYPE CHAR5. "分
DATA GV_WORD LIKE SPELL .GV_AMOUNT = GV_TOTAL .
CONDENSE GV_AMOUNT .
SPLIT GV_AMOUNT AT '.' INTO LV_INT LV_DEC."角
LV_CENT_INT = LV_DEC(1).
"分
LV_CENT_DEC = LV_DEC+1(1).CALL FUNCTION 'SPELL_AMOUNT'EXPORTINGAMOUNT = LV_INTCURRENCY = SY-WAERSFILLER = ' 'LANGUAGE = SY-LANGUIMPORTINGIN_WORDS = GV_WORDEXCEPTIONSNOT_FOUND = 1TOO_LARGE = 2OTHERS = 3.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
"输出 GV_WORD : 壹佰贰拾叁万肆仟伍佰陆拾柒
"角和分类似,手动去拼接
这篇关于打印 金额字段千分符设置 金额字段中文大写的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!