We studied the relationship between the charge doping and the correlation, and its effects on the spectral function of the BaFe$_2$As$_2$ compound in the framework of the density functional theory combined with the dynamical mean field theory (DFT+DMFT). The calculated mass enhancements showed that the electronic correlation varies systematically from weak to strong when moving from the heavily electron-doped regime to the heavily hole-doped one. Since the compound has a multi-orbital nature, the correlation is orbital-dependent and it increases as hole-doping increases. The Fe-3d$_{xy}$ (xy) orbital is much more correlated than the other orbitals, because it reaches its half-filled situation and has a narrower energy scale around the Fermi energy. Our findings can be consistently understood as the tendency of the heavily hole-doped BaFe$_2$As$_2$ compound to an orbital-selective Mott phase (OSMP). Moreover, the fact that the superconducting state of the heavily hole-doped BaFe$_2$As$_2$ is an extreme case of such a selective Mottness constrains the non-trivial role of the electronic correlation in iron-pnictide superconductors. In addition, the calculated spectral function shows a behavior that is compatible with experimental results reported for every charge-doped BaFe$_2$As$_2$ compound and clarifies the importance of the characterization of its physical effects on the material.