I've never had that problem, because I saw my friend go through it and learned when I was a new junkie. She got so constipated she had to go to the hospital. I went with her, and the nurse kind of gave her a lecture -not in a mean way, she was just like "Heroin constipates you. What do you do when you first wake up? You fix, right? And you fix throughout the day, and you fix before you go to bed. You never let your body come off the drug enough to move your bowels".
It was true - I remember one time I was in a bathroom with said friend and it'd taken us a while to cop, and she was about to fix, and said "oh fuck... don't shit don't shit don't shit". And I was like dude, I'll wait outside - just GO. But she didn't want to. No wonder she had to go have the hospital unplug her. One time she told me it wouldn't come out so she reached back there (gross I know, but such is the glamorous life of a junkie), and "I swear it was the size of a baby's head".
Anyway, the nurse said "try to get 8 hours of sleep, try not to fix right before bed, and when you wake up, drink 16 oz of water, wait 15 minutes, and go use the bathroom FIRST. Even if you feel like you don't have to go, just try. THEN go fix". it just stayed with me because I never wanted to be in my friend's position, laying on a hospital bed about to get an enema from a stranger. I followed the nurse's advice and I usually don't have a problem.