Differences between the dates can be achieved directly in BEx. CMOD code is not required. Follow this doc :---
Basically query refresh doesn't happen effectively in your case. You may give a try with RSRT.
Regarding your first problem, could you try by selecting Master Data values or Posted Values for navigation etc,, in Bex?