In this work, we study priori error estimates for the numerical approximation
of an optimal control problem governed by the heat equation with
certain control constraint and ending point state constraint. By making use of
the classical space-time discretization scheme, namely, finite element method
with the space variable and backward Euler discretization for the time variable,
we first project the original optimal control problem into a semi-discrete
control and state constrained optimal control problem governed by an ordinary
differential equation, and then project the aforementioned semi-discrete
problem into a fully discrete optimization problem with constraints. With the
help of Pontryagin's maximum principle, we obtain, under a certain reasonable condition of Slater style, not only an error estimate between the optimal
controls for the original problem and the semi-discrete problem, but also an
error estimate between the solutions of the semi-discrete problem and the fully
discrete problem, which leads to an error estimate between the solutions of the
original problem and the fully discrete problem. By making use of the aforementioned result, we also establish an numerical approximation for the exactly
null controllability of the internally controlled heat equation.