四舍五入算法 DATA: L_DATA TYPE P DECIMALS VALUE '1.456'. DATA: L_DATA1 TYPE P DECIMALS . DATA: L_DATA2 TYPE P DECIMALS VALUE '1.546'. * 方法一 CALL FUNCTION 'HR_NZ_ROUNDING_DECIMALS' EXPORTING VALUE_IN = L_DATA CONV_DEC = " 设置保留几位小数 IMPORTING VALUE_OUT = L_DATA1 EXCEPTIONS no_rounding_required = decimals_greater_than_10 = rounding_error = OTHERS = . WRITE: L_DATA1. * 方法二 CALL FUNCTION 'ROUND' EXPORTING DECIMALS = " 保留多少位小数 INPUT = L_DATA2 SIGN = '+' " + 向上取舍 - 向下取舍 (负数也一样) IMPORTING OUTPUT = L_DATA1 " 输出返回结果 EXCEPTIONS input_invalid = overflow = type_invalid = OTHERS = . WRITE: L_DATA1.