A general version of coupled-mode-theory for frequency domain scattering problems in integrated optics is proposed. As a prerequisite a physically reasonable field template is required, that typically combines modes of the optical channels in the structure with coefficient functions of in principle arbitrary coordinates. Upon 1-D discretizations of these amplitude functions into finite elements, a Galerkin procedure reduces the problem to a system of linear equations in the element coefficients, where given input amplitudes are included. Smooth approximate solutions are obtained by solving the system in a least squares sense. The versatility of the approach is illustrated by means of a series of 2-D examples, including a perpendicular crossing of waveguides, and a grating-assisted rectangular resonator. As an appendix, we show that alternatively a similar procedure can be derived by variational means, i.e. by restricting a suitable functional representation of the full 2-D/3-D vectorial scattering problem (with transparent influx boundary conditions for inhomogeneous exterior) to the respective field templates.