Date: 201605
Local time of day: 1801-2400
Location: ZZZ.Airport, US
Flight conditions: VMC
Light: Daylight
Aircraft: B737-700
Operator: Air Carrier
Operating under: Part 121
Flight plan: IFR
Mission: Passenger
Flight phase: Descent
ATC / advisory: Center ZZZ
Reporter organization: Air Carrier
Reporter function: Captain
Reporter qualification: Flight Crew Air Transport Pilot (ATP)
Human factors: Fatigue; Distraction; Situational Awareness
Anomaly: Deviation - Track / Heading All Types; Deviation / Discrepancy - Procedural Clearance; Deviation / Discrepancy - Procedural Published Material / Policy
Detector: Person Air Traffic Control
When detected: In-flight
Result: Air Traffic Control Issued New Clearance; Flight Crew Returned To Clearance; Flight Crew Became Reoriented
Contributing factors: Human Factors
Primary problem: Human Factors

Narrative: Prior to departure; we verified flight routing with flight plan. We were unable to verify with actual ATC clearance; because it was received on taxi out. This is the procedure at this specific international city. No problems with this; just unusual from our standard SOP. The route had just loaded; and we had just [arrived]; so we were familiar with the peculiarities of the day. There was a runway closure earlier in the day. Previous flights into and out of [the airport] were conducted with the specific runway closed. The expectation was that we would land on the same runway. The First Officer; in the loading of the FMC; put the anticipated runway in before departure. That's not something that is usually done; but given the previous flights; and the weather and winds; it seemed reasonable to leave it in the FMC. Takeoff; enroute; all uneventful briefings were conducted early and verified for the planned runway. Got the ATIS; and the other runway had opened. We set the courses and the ILS frequencies for the new runway in use. Prior to beginning the descent; the Pilot Monitoring (PM) had to use the lavatory; and had called the Flight Attendants; to ensure proper cockpit access. The Flight Attendants (FA) were not immediately available; as they were involved with the international forms for the Passengers. When they called to relieve the PM; we were in the middle of the ATIS; and the runway change. We received the descent clearance when the PM was not in the cockpit. With the additional communication difficulty of the oxygen mask; and the PM calling to regain entry back at that time; I do not recall the Controller giving us a descent clearance specific to a runway. I do know we were cleared to descend via the Arrival; and he also increased our speed to maintain 310 knots until ZZZZZ. Descent was uneventful in LNAV/VNAV. We turned earlier than the Controller anticipated; and he issued a heading to fly. At that point; we verified we were set for the correct runway. The ILS; CRS; and minimums for Runway XXR were set. The FMC had the wrong transition; which was overlooked in the planning phase of the approach; due to the expectation bias; and distractions at the moment the actual clearance was given; and the descent clearance that may not have been given specific to a runway. (I may have missed it I can't recall). There were no traffic conflicts; and I don't know what the lateral deviation was from the course. We may have been within limits of the RNP 1. Contributing to the error:*Distraction; as mentioned in narrative. *Fatigue and possible burnout; last leg of a [multiple]-day trip*Relatively short overnights of 12 hours the previous two nights*The first day very long; within 20 minutes of timing out with a FDP of 15 hours; getting to sleep [at a very early time]. *Approximately on duty 10 hours at the point of error that day as well.*PM new to airline and lack of line experience




Synopsis: B737-700 Captain reported a track deviation resulted after they got a late runway change and the FMC was not properly re-programmed.