主要使用
函数MOVE_CHAR_TO_NUM
或者 UNITS_STRING_CONVERT
第二个需要限制客户SU3 参数配置X
或者函数入参默认X, excel导出默认时X格式,
样例参考代码
*&---------------------------------------------------------------------* *& Report YWWZ_TEST57 *&---------------------------------------------------------------------* *& *&---------------------------------------------------------------------* REPORT ywwz_test57.DATA:lv_wrbtr TYPE resb-bdmng. DATA:lv_wrbtr_num TYPE mchb-clabs. DATA:lv_clabs TYPE mchb-clabs. DATA:lv_wrbtr_c TYPE char50. DATA:lv_wrbtr_c_str TYPE char50.DATA:lv_p_space TYPE char50. DATA:lv_p_x TYPE char50. DATA:lv_p_y TYPE char50.DATA:lv_dcpfm TYPE usr01-dcpfm. DATA:lv_units TYPE char50.SELECT SINGLE dcpfm INTO lv_dcpfmFROM usr01WHERE bname = sy-uname.lv_p_space = '336.341,210'. lv_p_x = '336,341.210'. lv_p_y = '-336 341,210'. "负数 336 341,21-CASE lv_dcpfm.WHEN ''.lv_wrbtr_c = lv_p_space.WHEN 'X'.lv_wrbtr_c = lv_p_x.WHEN 'Y'.lv_wrbtr_c = lv_p_y.WHEN OTHERS. ENDCASE.BREAK-POINT. CALL FUNCTION 'MOVE_CHAR_TO_NUM'EXPORTINGchr = lv_wrbtr_cIMPORTINGnum = lv_wrbtr_numEXCEPTIONSconvt_no_number = 1convt_overflow = 2OTHERS = 3.lv_clabs = lv_wrbtr_num.BREAK-POINT.lv_wrbtr_c_str = lv_wrbtr_c.IF lv_wrbtr_c+0(1) = '-'.SHIFT lv_wrbtr_c_str BY 1 PLACES . ENDIF.CALL FUNCTION 'UNITS_STRING_CONVERT'EXPORTINGunits_string = lv_wrbtr_c_strdcpfm = lv_dcpfm * MLLN = 'M' * TSND = 'T'IMPORTINGunits = lv_wrbtrEXCEPTIONSinvalid_type = 1OTHERS = 2.IF lv_wrbtr_c+0(1) = '-'.lv_wrbtr = lv_wrbtr * -1. ENDIF.lv_clabs = lv_wrbtr.WRITE lv_clabs. FINAL(lv_test_text) = |{ lv_clabs NUMBER = USER }|.BREAK-POINT.