Oneg Shabbos

One fine erev Shabbos, Rebbe Yannai was anxiously waiting for a gift of fruit to arrive. Every erev Shabbos without fail, an employee who worked in his field would dutifully bring a gift of fruit to show his appreciation for his wonderful employer. Consuming these fresh fruits on Shabbos was part of Rebbe Yannai’s oneg Shabbos.
Afraid that the employee might arrive too late for separating ma’aser before Shabbos, Rebbe Yannai acted. He took some fruit from his own stock and designated it as the terumah and ma’aser portion for the gift that was yet to come.
The problem is that there is a mitzvah to designate ma’aser and terumah only if the produce is nearby. In this incident, Rebbe Yannai was unaware of where the gift was. However, Rebbe Yannai felt he was justified in violating this principle due to the extenuating circumstances. The gift did eventually arrive, and it seems that Rebbe Yannai enjoyed the fruits in fulfillment of his oneg Shabbos.