• FM四舍五入_从小数点最后一位进位


    原贴地址:http://jiahongguang12.blog.163.com/blog/static/334665720071060551591/

       输入参数12.5445,因此FM从小数点最后一位进位,FM参数 CONV_DEC =2 为精确到第2位小数   ,

       打印结果:12.55;                     

      REPORT  Z_TEST_007.

    DATA : DAT TYPE P DECIMALS 9  VALUE '12.5445' ,
           DAT1 TYPE P DECIMALS 9 .

    *       MOVE DAT TO DAT1.

    CALL FUNCTION 'HR_NZ_ROUNDING_DECIMALS'
      EXPORTING
        VALUE_IN                       = DAT                      " Input field with decimals

       CONV_DEC                       = 2                         " i    Number of desired decimals for conversion

     IMPORTING
       VALUE_OUT                      = DAT1.                  " Output field with rounded decimals

    * EXCEPTIONS
    *   NO_ROUNDING_REQUIRED             = 1        " No rounding required. (CONV_DEC > VALUE_IN dec)

    *   DECIMALS_GREATER_THAN_10       = 2        " Conversion only possible with decimals <= 10

    *   ROUNDING_ERROR                          = 3        " An error occurred during the decimal conversion

    *   OTHERS                                           = 4.

    "  HR_NZ_ROUNDING_DECIMALS

    WRITE DAT1.

    注:处理的数据必须是数值类型,SAP默认四舍五入,如果是P类型可以直接定义小数位来限制

  • 相关阅读:
    从视频中每隔固定帧进行提取图片
    np.concatenate的超简单理解
    python-OOP(面向对象)
    机器学习中的ground truth
    深度学习网络中backbone是什么意思?
    缓存
    Linux基础命令
    openoffice相关命令
    HTTP协议
    Solr基础
  • 原文地址:https://www.cnblogs.com/ruingy/p/3392104.html
Copyright © 2020-2023  润新知