allocation expense for Scrap in production

Dear all,

How can we allocate the cost of scrap in ax?

Because when i report as finished and input the qty in good qty and error qty, all the cost are allocated to good qty.

Thanks in advance