06-16-2009 10:38 AM
Hej.
I am experiencing strange things with this bit of code. This code is taking place in FORM userexit_save_document_prepare in include MV45AFZZ.
And the result of the calculation is wrong, when I take the code and try it out in a new program, then i get a different results.
Here is the example.
xkomv-KWERT = 3.5
xkomv-KUMNE = 1000.
xkomv-KUMZA = 1000.
The result in the l_pris_pr_kg is : 1.8272945598830532E+01 But should be : 1.8272945598830531E-01
DATA: BEGIN OF xpreis OCCURS 20,
posnr TYPE kposn,
preis TYPE bapre,
DATA: END OF xpreis.
DATA: l_pris_pr_kg TYPE f.
LOOP AT xkomv WHERE kschl = 'ZMKP'. "
xpreis-posnr = xkomv-kposn.
l_pris_pr_kg = ( xkomv-KWERT * xkomv-KUMNE ) / xkomv-KUMZA.
xpreis-preis = l_pris_pr_kg.
APPEND xpreis.
ENDLOOP.
I have also tryed to put this into a STRING where in the Include MV45AFZZ I get the result
String = 18,
but in my test program i get the result
String = 0.18272945598831 (Which is correct).
So it seems that in this include I cannot get this to work correctly.
Is there anyone that has experienced something similiar, all help would be appreciated.
Thanks Gisli
06-16-2009 10:49 AM
HI,
Just check if teh fixed poitn arithmetic flag is set in the attributes of the program.
Regards,
Ankur Parab
06-16-2009 10:49 AM
HI,
Just check if teh fixed poitn arithmetic flag is set in the attributes of the program.
Regards,
Ankur Parab
06-16-2009 11:17 AM
Hi Ankur,
The problem lokks similar But, MV45AFZZ is a Standard include,
No Fixed point Arthematic Available,,,
Hi Gisli,
Try to divide i_pris_pr_kg by 100... Hope this could solve your problem...
Thanks & regards,
Dileep .C
06-16-2009 11:00 AM
Hello,
in SAPMV45A - which is the main program to this includes like MV45AF.. - there's no fixpoint-arithmetic active ! But if you create an own program, normally this flag is active by default.
So, you could write your logic in MV45AFZZ according to the digits that you have in your fields.
Practically you could divide the i_pris_pr_kg by 100.
Regards Wolfgang
06-16-2009 12:04 PM
Thank you very much, your comments explained my problem.
Best regards Gisli