Microscopic modelling of open systems: A generalized Wigner-function approach