Hi Shanmugam,
As mentioned by Sander, i would suggest write simple end routine.
Because if u implement this at query level, they it may decrease performance of the query, so routine will work.
create one more char(say required date).
if invoice_date is not initial.
reuired_date = invoice_date.
elseif posting_date is not initial.
reuired_date = posting_date.
endif.
now it is you choice whether u want to compromise with load performance / query performance.
Regards,
Hitesh