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

Problems while rounding values

Former Member
0 Kudos


i am getting KBETR values and displaying them in a type p decimals 5 field . Before display these values are being rounded off .....cos of which while displaying the type p field shows value 130.05000 instead of 130.4999...... how do i solve this




Former Member
0 Kudos

Hi Sindhu,

Take a character variable of KBETR length and pass KBETR value into this and display character variable instead of moving to a type p variable.



Former Member
0 Kudos


Before displaing move the value of the variable to char variable.

If useful reward points.



Developer Advocate
Developer Advocate
0 Kudos

Can you post some of the code.

This seems to output 130.50000.

data: KBETR_in   type KBETR value '130.4999' .
data: KBETR_out  type p decimals 5.

KBETR_out  = KBETR_in.

write:/ KBETR_out.


Rich Heilman

Former Member
0 Kudos

Hi All,

This is how KBETR is defined.

Domain         WERTV6                         Value field PL6 with 
                          Data Type  CURR       Currency field, stored as DEC 
                          <b>Length     11         Decimal Places   2</b>   

Thus it gets rounded to 130.50 and is stored in that way even when value assigned to it is 130.4999.

Consider this code.

REPORT zarun_2.
DATA: kbetr_in   TYPE kbetr ,
      kbetr_out  TYPE p DECIMALS 5,
      exrate     TYPE exrate.

kbetr_in = '130.4999' .
WRITE: / 'After Assigning to KBETR  :', kbetr_in.

exrate = '130.4999' .
WRITE:/  'After Assigning to EXRATE :', exrate.

kbetr_out  = kbetr_in.
WRITE:/  'After Assigning to TYPE P DEC 5(KBETR) :', kbetr_out.

kbetr_out  = exrate.
WRITE:/  'After Assigning to TYPE P DEC 5(EXRATE) :', kbetr_out.

<b>This is the output</b>

After Assigning to KBETR  :          130.50
After Assigning to EXRATE :             130.49990
After Assigning to TYPE P DEC 5(KBETR) :        130.50000
After Assigning to TYPE P DEC 5(KBETR) :        130.49990


Arun Sambargi.

Message was edited by: Arun Sambargi