Quasibound and continuum states are of particular importance for the numerical investigation of coherence properties and are sensitive with respect to the boundary condition chosen at the edge of the computational window. An open boundary condition will be derived which is particularly suitable for dynamical problems described by Schr\"odinger-type equations. With this approach, bound states as well as unbound states can be described adequately. The boundary condition is derived from a perfectly matched layer (PML) formalism commonly used in the field of electrodynamics. Consequently, the calculation domain is reduced leading to a calculation time reduction by orders of magnitude. From the physical point of view this formulation allows an adequate analysis of transport phenomena or absorption spectra, e.g., the results obtained by the PML formalism are compared with accurate numerical results calculated using a large mesh and show an excellent performance. For example, the Coulomb enhanced Franz-Keldysh effect is investigated, which cannot be analyzed adequately without using proper open boundary conditions.