Hybrid analog–digital (HAD) architecture is a promising means to realize large-scale arrays owing to the judicious trade-off between system performance and hardware complexity. This paper investigates the beampattern shaping of HAD arrays through minimizing the beampattern matching error between desired and actual patterns. Due to the nonconvex constraints on analog and digital weights and the nonconvex nonsmooth objective function, the resultant codesign is NP-hard. To address this issue, we create an efficient algorithm by leveraging block coordinate descent (BCD) and Riemannian manifold optimization. We first equivalently represent the objective function as a smooth bi-quadratic function by introducing a uni-modulus auxiliary variable. Subsequently, we alternatingly optimize the scaling factor, digital weights, analog weights and auxiliary variable under the BCD framework, where the simultaneous update of analog weights and auxiliary variable is recast as uni-modular constrained quadratic programming which is efficiently solved by Riemannian Newton method, and the digital weights have a global optimal solution via Lagrangian multiplier method. We also derive an explicit convergence condition of this algorithm. Numerical results demonstrate that the proposed algorithm has superior performance and faster convergence speed than alternative algorithms, and produces nearly the same mainlobe gain as fully digital arrays with significantly fewer radio-frequency chains.