TITLE: When does the sheaf direct image functor f_* have a right adjoint?
QUESTION [11 upvotes]: Say f: X → Y is a morphism of schemes.  The sheaf direct image functor f★ always has a left adjoint, namely the sheaf inverse image functor f★ (with tensoring).

Under what (sufficient) conditions do we know that f★ has a right adjoint?  What is it?

Answer to a related question (edit): If f★ preserves quasicoherence, then its restriction to quasicoherents f★: QCoh(X) → QCoh(Y) has a right adjoint when f is affine (in particular, any closed immersion or finite morphism will do).  The basic idea is to globalize the affine case (see Eric Wofsey's answer below); thanks to Pablo Solis for pointing me to page 6 of Ravi Vakil's notes explaining this.
In this question, I'm not restricting to the quasi-coherent categories.  One reason for working with non-quasicoherents is that j! , the "extension by zero" right adjoint to j★ for an open immersion j, doesn't take qcoh to qcoh.

REPLY [4 votes]: For your question. 
i agree with the answer from Greg, but in a different formalism. He used derived category. I did not. If f:X--->Y is a morphism of scheme. Then if f is affine morphism. Then direct image functor f_* :Cx---->Cy, has right adjoint functor f^!. Where Cx and Cy are category of sheaves or in particular, category of quasi coherent sheaves. So, in general, what we need is only the scheme is quasi compact and quasi separated.(I believe the quasi compact can be dropped, but I need some time to check globalization, I believe the flag variety of affine Kac-Moody algebra which is not quasi compact lies in this case).
The reference is 
M.Kontsevich and A.Rosenberg
Noncommutative spaces and flat descent. MPIM preprint
There is another related question. In category of quasi coherent sheaves. Say, if we have scheme morphism X---->Y, we always can get inverse image functor f^*: QcohY--->QcohX. But the direct image functor does not always exist. But if the scheme we are talking about is quasi compact and quasi separated. It exists. There is of course weaker condition. For this case, one can see the following papers:
1 D.Orlov Quasi coherent sheaves in commutative and noncommutative geometry
2 M.Kontsevich, A.Rosenberg. Noncommutative stack MPIM preprint 
3 SGA 6