2011 Oct 27 5:59 PM
A new Material conversion was created in MM02 for a Karton....'KAR'. The conversion is KG to KAR.
The original ABAP logic was zresult = 102 / 5. This should equal 20.4:
The code used
marm-umrez = marm-umrez / marm-umrenthe result is 20, missing decimal value.
I understand that umrez and umren are not decimals so a decimal cannot be assigned to the result so I tried this:
DATA: znew_value(5) type p DECIMALS 3.
DATA: umrez_new(5) type p DECIMALS 2.
DATA: umren_new(5) type p DECIMALS 2.
umrez_new = marm-umrez .
umren_new = marm-umren.
znew_value = umrez_new / umren_new.I still get 20 instead of 20.4?
I have played with the syntax unpack, write to, assign to, and move to, but my syntax cold have been off.
Can anyone suggest how I can use, or define a new field, or fields to pass them into so that I will get the decimal value after the calculation? Or, possible syntax for calculating the result using the original fields that will have the decimal value.
Thank-You
2011 Oct 27 6:29 PM
Hi Tom,
This issue drove me nuts once before. In your program look at the attributes. Make sure the checkbox is checked for Fixed point arithmetic.
Brenda
Hi Tom,
This issue drove me nuts once before. In your program look at the attributes. Make sure the checkbox is checked for Fixed point arithmetic.
Brenda
2011 Oct 27 6:05 PM
Looks like Fixed point Arithmetic is not set in the Program Attributes. If you code is in the User Exit, most probably the std SAP program would have it switched off. You should create a FM to do the calculation and bring the values back to the user exit.
Regards,
Naimesh Patel
2011 Oct 27 6:10 PM
Hi,
From ur code, I written the below code.
DATA: znew_value(5) type p DECIMALS 3.
DATA: umrez_new(5) type p DECIMALS 2.
DATA: umren_new(5) type p DECIMALS 2.
DATA: marm TYPE marm.
marm-umrez = 102.
marm-umren = 5.
umrez_new = marm-umrez .
umren_new = marm-umren.
znew_value = umrez_new / umren_new.
BREAK-POINT.
Its giving the perfect result.
Can you try this one in a test program. If this one is working in SE38 program then its a arithmetic problem of any routine. 😛
To overcome this one you have to write one small FM and build the logic there. Its a magic
Regards
Subhankar
Edited by: Subhankar Garani on Oct 27, 2011 7:11 PM
2011 Oct 27 6:29 PM
Hi Tom,
This issue drove me nuts once before. In your program look at the attributes. Make sure the checkbox is checked for Fixed point arithmetic.
Brenda
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |