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: 

based on arithmetic operation

Former Member
0 Kudos

hello experts,

I have a value with two decimals and one more value with 3 decimals,

when i try to divide the first one by the second one it is giving me wrong result.

ex: 375,000.00 / 15,000.000 = 0.03

How to solve this problem....

plz help me.

4 REPLIES 4

former_member582701
Contributor
0 Kudos

How many decimals have the variable of the result?

It's like u have a trunk to 2 decimals.

DATA: v_result TYPE P DECIMALS 3.

375,000.00 / 15,000.000 = v_result

Put your code if it doesn¡t work

regards

Former Member
0 Kudos

Hello try this

DATA : a(10) TYPE p DECIMALS 2,

b(10) TYPE p DECIMALS 3,

c(10) TYPE p DECIMALS 2.

a = '375000.00'.

b = '15000.000'.

c = a / b .

WRITE: c.

it works properly & gives output as 25.00

reward points if helpful

Former Member
0 Kudos

Hi vinil,

i do it like this and it works:

data: p1 type p decimals 2 value 375000.

data: p2 type p decimals 3 value 15000.

*

data: r1 type p decimals 2.

*

r1 = p1 / p2. "R1 gets 25,00

*

write: r1.

Can you show the declaration of your fields.

Regards, Dieter

0 Kudos

this is my code.......

SELECT SINGLE * FROM EKPO INTO S_EKPO WHERE EBELN = L_EBELN AND EBELP = L_EBELP.

DATA: V_RATE TYPE EKPO-NETWR.

V_RATE = S_EKPO-BRTWR / S_EKPO-MENGE .