Although it's a bit pricier than just buying vacuum tube at an auto store, I just went to the nearby BMW dealership and got a complete replacement tube. I think it was between 15 and 20 bucks. The new one has like a woven piece on each end to strengthen where it connects. The old one (which I had and looks like you have) is actually 3 pieces stuck together.
Mine broke exactly where yours did. The whole tube is going to be brittle - instead of just repairing it at that spot, consider replacing that whole tube.
The tube runs just behind the engine near the top in the middle. You can follow it back with your hand and feel where it connects. When you get a new one from the dealership (or a regular vacuum tube) just pop it in on the back, weave it through to the front, and it's good to go!
I got some codes from this happening as well so definitely expect them.