  Let $G$ be a connected split reductive group over a finite field ${\mathbb
F}_q$ and $X$ a smooth projective geometrically connected curve over ${\mathbb
F}_q$. The $\ell$-adic cohomology of stacks of $G$-shtukas is a generalization
of the space of automorphic forms with compact support over the function field
of $X$. In this paper, we construct a constant term morphism on the cohomology
of stacks of shtukas which is a generalization of the constant term morphism
for automorphic forms. We also define the cuspidal cohomology which generalizes
the space of cuspidal automorphic forms. Then we show that the cuspidal
cohomology has finite dimension and that it is equal to the (rationally)
Hecke-finite cohomology defined by V. Lafforgue.
