Sayyiduna Abdullah bin Amr (may Allah be pleased with him) said that the Messenger of Allah (peace and blessings be upon him) said: "When a man loses his ablution at the end of his prayer, after raising his head from the (last) prostration and before giving the salam, his prayer is valid."
It is narrated from Abd al-Rahman bin Ziyad: When the imam has sat (in the last sitting) and then loses his ablution before giving the salam, his prayer is complete.
Mu'adh bin al-Hakam narrated this same narration from Abd al-Rahman bin Ziyad and added in it: 'wa qada fihi tashahhudah' (having completed the tashahhud in it).
Abd al-Rahman bin Ziyad is al-Ifriqi; Yahya al-Qattan, Abd al-Rahman bin Mahdi, Ahmad bin Hanbal, Yahya bin Ma'in and other imams of hadith declared him da'if (weak). There is also disagreement over this narration from him, and it is mentioned with its defects in Kitab al-Khilaf.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الصلاة / 2823