Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Round Up

Former Member
0 Likes
345

Hi !

Please, if i use for example

a type f

b type p decimals 2.

a = 19,64332333

move a to b or write a to b, the result is 19,64 i need roud up to 19,65, how can i do ?

thanks

2 REPLIES 2
Read only

Former Member
0 Likes
325

HI,

Use floor(variable name).

Thanks,

Sriram Ponna.

Read only

Former Member
0 Likes
325

DATA : f_var TYPE f,
       p_var(16) TYPE p DECIMALS 2.

f_var = '19.64632333'.

"Note: if value 19.64332323 then it rounds to 19.64
"if value id 19.64732333 then it rounds to 19.65 because 3 decimal is more than 5.
"in first case 3 decimal is less than 5.

CALL FUNCTION 'ROUND'
  EXPORTING
    decimals      = 2
    input         = f_var
  IMPORTING
    output        = p_var
  EXCEPTIONS
    input_invalid = 1
    overflow      = 2
    type_invalid  = 3
    OTHERS        = 4.

WRITE p_var.