2 weeks ago
Hi,
you can multiply two decimal numbers in your ABAP program properly if the "Fixed point arithmetic" checkbox is marked in the program attributes (see Case 1 below, on the left side).
If the mentioned field isn't checked I get the same result as in your program (see Case 2 on the right side).
In my system in your Function Group V61A the "Fixed point arithmetic" checkbox is not marked:
In the help (F1) for this field:
If you mark this checkbox, all calculations in the program will use fixed point arithmetic.
If you do not, packed numbers (ABAP/4 type P, Dictionary types CURR, DEC or QUAN) will be treated as integers when they are used in assignments, comparisons, and calculations, irrespective of the number of decimal places defined. Intermediate results in arithmetic calculations will also be rounded to the next whole number. The number of decimal places defined is only taken into account when you output the answer using the WRITE statement.
By the way, the program status for the Function Group is "T" (Test Program). Maybe you should use for your purposes another, production, program, with fixed point arithmetic?
Best regards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you very much to everyone for your explanations and comments. But this "function group" being studied is currently used by all users in the live system. Therefore I cannot change the "fixed point arithmetic" property anymore. One point I don't understand is this: Why work with the "fixed point arithmetic" feature removed? If working with decimal numbers, wouldn't anyone want to see the correct mathematical operations? If you do not want to work with decimal numbers, you can work with integers in the program. Why would you remove the "fixed point arithmetic" feature? It doesn't make sense to me.
Thanks .
If you don't check fix point arithmetic you should use float instead of packed numbers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
While working on a similar requirement to multiply numbers, i too found this strange, however i found a solution that while multiplying we need to divide this number by 10,100 or 1000 depending on the number of decimals that we have in amount.
for 1 decimal point we can divide by 10,
for 2 decimal point we can divide by 100,
and so on...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
69 | |
8 | |
8 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.