Hello everyone.
I have a problem when I use FOX Formula in BPS.
I wrote such kind of Formula:
DATA MT TYPE Y_MATNR .
DATA MN TYPE Y_MONPOST .
DATA QN TYPE F.
DATA QN2 TYPE I.
FOREACH MT.
FOREACH MN.
IF {Y_FREE_PR,MT,MN}>0.
QN2 = QN2 + 1.
QN = QN + {Y_FREE_PR,MT,MN}.
ENDIF.
ENDFOR.
{Y_TOTNORM,MT,#} = QN2.
{Y_TOTNSUM,MT,#} = QN / QN2 .
QN2 = 0.
QN = 0.
ENDFOR.
I try to calculate average price, but when I calculate it {Y_TOTNSUM,MT,#} = QN / QN2 with using of variable type I and F I became only total price from all materials. My variable QN2 that calculate how many same of materials name I have per month doesnt work. So formula doesnt divide total price by material quantity. Can somebody help my with my problem? (my variable QN2 doesnt work).
Thanks for answers.