For them there will be allotted a share for what they have earned. And Allah is swift at reckoning.
Hence, Allah praised those who ask for the affairs of both this life and the Hereafter. He said;
وِمِنْهُم مَّن يَقُولُ رَبَّنَا اتِنَا فِي الدُّنْيَا حَسَنَةً وَفِي الاخِرَةِ حَسَنَةً وَقِنَا عَذَابَ النَّارِ
And of them there are some who say;"Our Lord! Give us in this world that which is good and in the Hereafter that which is good, and save us from the torment of the Fire!"
The supplication mentioned and praised in the Ayah includes all good aspects of this life and seeks refuge from all types of evil. The good of this life concerns every material request of well-being, spacious dwelling, pleasing mates, sufficient provision, beneficial knowledge, good profession or deeds, comfortable means of transportation and good praise, all of which the scholars of Tafsir have mentioned regarding this subject. All of these are but a part of the good that is sought in this life. As for the good of the Hereafter, the best of this includes acquiring Paradise, which also means acquiring safety from the greatest horror at the gathering place. It also refers to being questioned lightly and the other favors in the Hereafter.
As for acquiring safety from the Fire, it includes being directed to what leads to this good end in this world, such as avoiding the prohibitions, sins of all kinds and doubtful matters.
Al-Qasim bin Abdur-Rahman said,
"Whoever is gifted with a grateful heart, a remembering tongue and a patient body, will have been endowed with a good deed in this life, a good deed in the Hereafter and saved from the torment of the Fire."
This is why the Sunnah encourages reciting this Du`a (i.e., in the Ayah about gaining a good deed in this life and the Hereafter).
Al-Bukhari reported that Anas bin Malik narrated that the Prophet used to say;
اللَّهُمَّ رَبَّنَا اتِنَا فِي الدُّنْيَا حَسَنَةً وَفِي الاخِرَةِ حَسَنَــةً وَقِنَا عَذَابَ النَّار
O Allah, our Lord! Give us that which is good in this life, that which is good in the Hereafter and save us from the torment of the Fire.
Imam Ahmad reported that Anas said,
"Allah's Messenger visited a Muslim man who had become as weak as a sick small bird. Allah's Messenger said to him, `Were you asking or supplicating to Allah about something?'
He said, `Yes. I used to say;O Allah! Whatever punishment you saved for me in the Hereafter, give it to me in this life.'
Allah's Messenger said;
سُبْحَانَ اللهِ لَا تُطِيقُهُ أَوْ لَا تَسْتَطِيعُهُ فَهَلَّ قُلْتَ
All praise is due to Allah! You cannot bear it -or stand it-. You should have said;
رَبَّنَا اتِنَا فِي الدُّنْيَا حَسَنَةً وَفِي الاخِرَةِ حَسَنَةً وَقِنَا عَذَابَ النَّارِ
Our Lord! Give us in this world that which is good and in the Hereafter that which is good, and save us from the torment of the Fire!
The man began reciting this Du`a and he was cured."
Muslim also recorded it.
Al-Hakim reported that Sa`id bin Jubayr said,
"A man came to Ibn Abbas and said, `I worked for some people and settled for a part of my compensation in return for their taking me to perform Hajj with them. Is this acceptable?'
Ibn Abbas said, `You are among those whom Allah described;
أُولَـيِكَ لَهُمْ نَصِيبٌ مِّمَّا كَسَبُواْ وَاللّهُ سَرِيعُ الْحِسَابِ
For them there will be allotted a share for what they have earned. And Allah is swift at reckoning.
Al-Hakim then commented;
"This Hadith is authentic according to the criteria of the Two Sheikhs (Al-Bukhari and Muslim) although they did not record it.