Al-Imām al-Bukhārī - upon whom be mercy - narrates: Ibrāhīm ibn al-Mundhir related to us; he said: Anas ibn ‘Iyāḍ related to us, from ‘Ubaydullāh, from Muḥammad ibn Yaḥyā ibn Ḥibbān, from Wāsi’ ibn Ḥibbān,
that ‘Abdullāh ibn ‘Umar - may Allāh Almighty be content with both of them - said: I once went up onto the roof of the house of our mother Ḥafṣah - may Allāh Almighty be content with her - for some need of mine, and I saw the Messenger of Allah ﷺ relieving himself. His back was toward the Qiblah, and his face was toward Shām.
حَدَّثَنَا إِبْرَاهِيمُ بْنُ الْمُنْذِرِ قَالَ: حَدَّثَنَا أَنَسُ بْنُ عِيَاضٍ، عَنْ عُبَيْدِ اللهِ، عَنْ محَمَّدِ بْنِ يَحْيَى بْنِ حَبَّانَ، عَنْ وَاسِعِ بْنِ حَبَّانَ، عَنْ عَبْدِ اللهِ بْنِ عُمَرَ قَالَ
ارْتَقَيْتُ فَوْقَ ظَهْرِ بَيْتِ حَفْصَةَ لِبَعْضِ حَاجَتِي، فَرَأَيْتُ رَسُولَ اللهِ ﷺ يَقْضِي حَاجَتَهُ مُسْتَدْبِرَ الْقِبْلَةِ، مُسْتَقْبِلَ الشَّأْمِ.
Reference: Sahih Al Bukhari 148