By looking at your screenshot, I can see that the cost for that product is 0. Perhaps because that product does not have any purchase price at this time.
If you want to set the purchase price to that product from there, you have to add the cost (the total column in that screenshot) first. Once you do so, the "Set purchase price" button, will set the product's purchase price to the value you have set there.
Now, as you have 0, it's trying to set 0 to the purchase price, so it's working as expected...