I'll approach this from what is perhaps a surprising angle.
Head transplants have been done.
It is of course not quite as simple as no one has actually succeeded in connecting the spinal cord in a way that allows the head to control the body in any way.
There has been quite a bit of research however. And according to one expert in 2013, the possibility exists to re-fuse a severed cord by use of fusogens. How exactly this will pan out is far beyond my medical knowledge, but it doesn't seem entirely unlikely that this will be possible in the future.
So what we have now is a male head with a female body and vice versa. From there on, it seems like a question of exchanging more (not too difficult to transplant) parts until you are happy to say that the your subject looks like a man with a functional female reproduction system rather than the head of a man on the body of a woman.
A hormone treatment additionally to what the sex organs produce themselves will likely be necessary to keep the female reproduction system functional (luckily this will also help with lactation.
Sexual stimulation
As for sexual stimulation, A clitoris is essentially the same as a penis[citation needed], with the same nerves leading to it. So after connecting the spinal cord, stimulating the penis should then for a female create similar reactions as the clitoris once did. It's not clear if the reaction of the brain will actually trigger an ejaculation though. much is still unclear about the female orgasm. And I don't Believe anyone has bothered to find out if a female brain knows how to make a male body ejaculate (though come to think of it...). That being said, the brain can adapt to almost anything, and I believe that claiming the reaction of the female brain to sexual stimulation is similar enough to a man's to trigger ejaculation won't stretch anyone's imagination.