Assuming that it is not the result of an infection or other medical problem, you can train your dog to pee/poop in the place you want, and when you want it. I rate this training to be very handy. To see why, imagine yourself on a trip and you stop at a rest area for a pee break in the pouring rain.
It is a bit of a pain to teach, but is well worth it if you like traveling. Just use the same techniques you would to train a pup to pee/poop at a given location in your yard. The hassle part of the training is that you use a leash, which means you have to wait for them or take them out frequently until they learn what they are supposed to do.