We discuss a new density of states (DoS) approach to solve the complex action problem that is caused by
topological terms. The key ingredient is to use open boundary conditions for (at least) one of the directions, such that the
quantization of the topological charge is lifted and the density becomes a regular function. We employ the DoS FFA method
and compute the density of states as a function of the topological charge. Subsequent integration with
suitable factors gives rise to the observables we are interested in. We here explore two test cases: U(1) lattice gauge
theory in two dimensions, and SU(2) lattice gauge theory in four dimensions. Since the 2-d case has an exact solution we
may use it to assess the method, in particular to establish the equivalence of the open boundary results with the usual choice of
periodic boundary conditions. The SU(2) case is a first step of developing the techniques towards their eventual
application in full QCD.