Weld a two-piece valve (with extended connections) directly into the piping system, taking care not to overheat the valve (seal may get damaged), by cooling the valve during welding.
A three-piece valve is first pre-assembled between the connections (tack weld), and the connections are welded after the body with seals is removed. After the connections are cooled, the valve body is assembled, making sure that the ball is in the closed position when the body is screwed together with the connections. The entire unit is screwed together with the correct torque.
When welding valves, it is important to align both connections of the piping system and to prepare their ends for the chosen welding technology.