FM rounding _ carry from the last decimal point

Source: Internet
Author: User

Original post address: http://jiahongguang12.blog.163.com/blog/static/334665720071060551591/

 

The input parameter is 12.5445, so the FM is carried from the last decimal point. The FM parameter conv_dec = 2 is accurate to 2nd decimal places,

Printed result: 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.

 

Note: the processed data must be numeric. SAP is rounded to the nearest integer by default. If it is p type, you can define decimal places to limit it.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.