Dear Vadim,
the script which you suggested for addition column value is not working.
My assumptions from your script.
From first section (//Preliminary calculation - sum F_130,F_410 for all materials) First we add the deduction+min. stock balance for all material into addition.
Lets take example that deduction+min. stock balance for all material is 400000.
Then as per second section (//Preliminary calculation - subtract F_INV for NA) we add the negative F_INV into the same addition value, i.e in our case the F_INV is 396000, so after after execution of second section, the value will be added to addition as 400000 + ( - 396000) which should be equal to 4000, but when executed, it is overwriting the value with -396000 resulting in wrong calculation.
Kindly assist.