A motor valve comprising: a plurality of ports connected to a valve chamber of the motor valve, the plurality of ports comprising a first port and a second port communicated with each other via the valve chamber; a plurality of pipes fixed respectively to the plurality of ports and connecting the motor valve and an external device, the plurality of pipes comprising a first pipe fixed to the first port and a second pipe fixed to the second port, wherein refrigerant flows from the second pipe arranged in the lateral direction toward the first pipe extending downward, a cylindrical-shaped orifice fitted into the first port, wherein a valve seat is formed around a central opening of the orifice, a rod-shaped valve shaft movable up and down inside a space within the valve chamber for controlling the flow rate of the refrigerant passing through the valve seat by controlling the width of a gap between the valve seat portion and a tip of the valve shaft; and a rectifying member inserted into the second pipe, wherein the second pipe includes a large diameter portion, a small diameter portion formed on the valve chamber side of the large diameter portion, and a step portion provided at a boundary portion between the large diameter portion and the small diameter portion; the rectifying member is fixed to the large diameter portion of the second pipe by a positioning means in a state where the rectifying member and the step portion are brought into contact with each other and an axial movement of the second pipe is restricted by the step portion; characterized in that the positioning means is a swaging portion that deforms a wall portion of the second pipe facing the rectifying member in the inner diameter direction of the second pipe and fixes the rectifying member to the wall portion of the second pipe. a plurality of ports connected to a valve chamber of the motor valve, the plurality of ports comprising a first port and a second port communicated with each other via the valve chamber; a plurality of pipes fixed respectively to the plurality of ports and connecting the motor valve and an external device, the plurality of pipes comprising a first pipe fixed to the first port and a second pipe fixed to the second port, wherein refrigerant flows from the second pipe arranged in the lateral direction toward the first pipe extending downward, a cylindrical-shaped orifice fitted into the first port, wherein a valve seat is formed around a central opening of the orifice, a rod-shaped valve shaft movable up and down inside a space within the valve chamber for controlling the flow rate of the refrigerant passing through the valve seat by controlling the width of a gap between the valve seat portion and a tip of the valve shaft; and a rectifying member inserted into the second pipe, wherein the second pipe includes a large diameter portion, a small diameter portion formed on the valve chamber side of the large diameter portion, and a step portion provided at a boundary portion between the large diameter portion and the small diameter portion; the rectifying member is fixed to the large diameter portion of the second pipe by a positioning means in a state where the rectifying member and the step portion are brought into contact with each other and an axial movement of the second pipe is restricted by the step portion; characterized in that the positioning means is a swaging portion that deforms a wall portion of the second pipe facing the rectifying member in the inner diameter direction of the second pipe and fixes the rectifying member to the wall portion of the second pipe.