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: 

Decimal- Currency Division problem

Former Member
0 Kudos

Hi All,

I want to divide the Currency value by decimal value.

When i try to it, it returns the rounded value and not the exact value.

For ex:

data: sal like pa0008-bet01 value '50570.06',

amnt type decimals 2 value '57462.23',

ans TYPE p LENGTH 11 DECIMALS 2.

ans = ( sal / amnt ) * 100.

write:/ ans.

It returns 0.01 and it should be 88.01

Thanx in advance

5 REPLIES 5

Former Member
0 Kudos

Hi

The following code it returns 88.01

data: sal like pa0008-bet01 value '50570.06',

amnt type p decimals 2 value '57462.23',

ans type p decimals 2.

ans = ( sal / amnt ) * 100.

write:/ ans.

Just execute the above code.

Regards

Raja.

Former Member
0 Kudos

Hii ..check with the amount declaration

amnt type p LENGTH 8 decimals 2 value '57462.23'

Rgds,

Former Member
0 Kudos

Hi,

ans type p decimals 2 , would solve ur problem.

Regards.

Former Member
0 Kudos

Hi,

In your code change this

amnt type decimals 2 value '57462.23',

to amnt type p decimals 2 value '57462.23',

it will work out.

Former Member
0 Kudos

Hi,

Jus try this...

data: sal like pa0008-bet01 value '50570.06',

amnt type p decimals 2 value '57462.23',

ans TYPE p LENGTH 11 DECIMALS 2.

ans = ( sal / amnt ) * 100.

write:/ ans.