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.
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.