I had the same problem when I started adding a LOT of whole grain and veggies to my diet! Had I known I should have taken in the new eating regimen slowly, maybe I wouldn't have experienced the umm, well, you don't need details. haha
But it took my body about 1 1/2 months to adjust completely!!! I don't get it anymore (thank goodness) but it was definitely annoying when it was happening...!!