XKOMV-KWERT isn't calculated while creating an order
I created the following calculation rule:
XKOMV-KBETR = KOMP-KZWI2.
XKOMV-KBETR = XKOMV-KBETR * 1000 / KOMP-MGAME.
XKOMV-KWERT = XKOMV-KBETR / 1000 * KOMP-MGAME.
If I now create an order, XKOMV-KWERT isn't calculated, means value = 0,00. After changing eg. the price, it's correctly calculated. The same after saving the order, the XKOMV-KWERT is filled with the right value.
Please help me to get this working right.
Thank you and regards,
Brian Sammond replied
You may have to save the value in XKWERT instead of (or in addition to) XKOMV-KWERT.
This may be due to scoping issues.
One suggestion I would make is to put a breakpoint in your routine and look at the call stack when you create an order vs. when you change or save an order.
You may find that you have a different context in each situation (as I found with regard to XKOMV with some VOFM pricing requirements), so that you cannot rely on the integrity of XKOMV without some extra work, since the scoping might be different in each case.
If that is the case, we may have to go into further detail. There is a workaround for that.
But first try using XKWERT.
Basically, at the end of your routine:
XKWERT = XKOMV-KWERT.
(I still think you should simplify your other logic to eliminate the possibility of rounding errors.)
Message was edited by: