Can gas or constipation effect a mans ability to get a erection or sustain a erection?

Only. Because you may be self conscious about a 'gastronomical' disaster during sex. That is assuming you had no pre-existing difficulty with obtaining and maintaining...