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.
cancel
Showing results for 
Search instead for 
Did you mean: 

Addition of decimal values in char fields

Former Member
0 Kudos

I want 0.00 + 0.00 = 0.00, in my case its happening as:

0.00 + 0.00 = 0.

Values are stored in CHAR field.

3 REPLIES 3

Former Member
0 Kudos

*check the length of your variable.

*see bellow example change the length of varibale charv and see the difference.

REPORT ztest.

data: charv type char5.

charv = '0.00 + 0.00 = 0.00'.

write charv.

thanks

ganesh

Former Member
0 Kudos

well this wont work with char fields.

move your values to type p fields before summing and the move your sum back to the char field.

you can use the addition right-justified and decimals 2.

Former Member
0 Kudos

Hi Anand,

Try this way :

Data :
  w_var1 type p decimals 2 value '0.00',
  w_var2 type p decimals 2 value '0.00',
  w_var3 type p decimals 2.

w_var3 = w_var1 + w_var2.

write 😕 w_var3.

Regards,

Swapna.