Use ceil( ) or floor( ) to round decimal to integer, respectively to upper or lower integer value.
DATA(lv_upper_value) = ceil( '0.333' ). " ==> 1
DATA(lv_lower_value) = floor( '1.66' ). " ==> 1
Use the round( ) method to have more possibilities :
DATA : lv_percentage TYPE numc3.
" [...]
" In this case, the percentage calc is round to lower integer value :
lv_percentage = = CONV #( round( val = lv_num / lv_total * 100
dec = 0
mode = cl_abap_math=>round_down ) ).
You can specify in wich mode you want to round number with :
CL_ABAP_MATH=>ROUND_HALF_UP | Round away from zero if value is exactly half
CL_ABAP_MATH=>ROUND_HALF_DOWN | Round to zero if value is exactly half
CL_ABAP_MATH=>ROUND_HALF_EVEN | Round so last digit is an even no. if value is exactly half
CL_ABAP_MATH=>ROUND_UP | Round away from zero
CL_ABAP_MATH=>ROUND_DOWN | Round to Zero
CL_ABAP_MATH=>ROUND_CEILING | Round to Positive Infinity
CL_ABAP_MATH=>ROUND_FLOOR | Round to Negative Infinity
Search tag : arrondi, arrondir, entier, valeur supérieure, inférieure