It's a behavior problem - very common! Has nothing to do with not getting enough food or physical problems. They do it out of boredom, seeking attention, what kind of dog do you have and how old is he?
There's a powder you can buy from the vet's office, put it in his food and when he tries to eat his poop again he will hate the taste and won't try again. Works really well. Here's the name of the powder: Forbid, it comes in little paper packages, made by Alpar Labortory. You can go to any animal hospital and get it without prescription. Get it tonight and you will see the difference!