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

Decimal

Former Member
0 Likes
668

In fm if i divide this price 594.94 with this quantity 6.637 .i am getting 0.08 ,but exact value is 89.64.

how to resolve it .price fields r declared with currency type of decimal 2.

1 ACCEPTED SOLUTION
Read only

matt
Active Contributor
0 Likes
643

Does the function group main program of the function module have the checkbox "Fixed Point Arithmetic" checked?

I created this program and ran it once with that checkbox checked, and once without.

DATA: a TYPE p DECIMALS 2 VALUE '594.94',
      q TYPE p DECIMALS 3 VALUE '6.637',
      c TYPE p DECIMALS 2.

c = a / q.

WRITE: a, q, c.

When the checkbox is set, I get the right answer, when not, I get 0.09.

matt

6 REPLIES 6
Read only

former_member242255
Active Contributor
0 Likes
643

is it not possible with normal division method..

Read only

Former Member
0 Likes
643

hi,

please check the quantity field..... i think its taking 6637 instead of 6.637...

May be the deciamals are not given in that... so just check out in the program from where you are calling this FM is it passing the correct values or not....

Regards,

Siddarth

Read only

Former Member
0 Likes
643

just multiply your 594.94 with 1000 before doing your division.

Read only

0 Likes
643

Hi Florian Kemmer,

Its get resolved ..thanks a lot ..

Read only

matt
Active Contributor
0 Likes
644

Does the function group main program of the function module have the checkbox "Fixed Point Arithmetic" checked?

I created this program and ran it once with that checkbox checked, and once without.

DATA: a TYPE p DECIMALS 2 VALUE '594.94',
      q TYPE p DECIMALS 3 VALUE '6.637',
      c TYPE p DECIMALS 2.

c = a / q.

WRITE: a, q, c.

When the checkbox is set, I get the right answer, when not, I get 0.09.

matt

Read only

former_member222860
Active Contributor
0 Likes
643

Pl. check the declaration of Qty field in FM.

data: pr type p decimals 2 value '594.94'.
data: qt type p decimals 3 value '6.637'.
data: tot type p decimals 3.

tot = pr / qt.

write:/ tot.