The dynamical theory of diffraction in a crystal modulated by a surface acoustic wave in the case of spatially restricted X-ray beams