A generic integral equation and method of moments formulation is presented for laterally bounded stratified media including planar metallization. The main asset of the developed approach is its flexibility, as it encompasses generic lateral boundary conditions and explicitly applies to any linear subsectional basis functions with constant surface divergence. This includes the rooftop functions on rectangular and triangular supports currently proposed in standard method of moment meshers. This approach provides closed expressions for the coupling integrals appearing in the method of moments matrix elements. These formulas are based of Green's functions modal expansions and in the possibility, conclusively demonstrated in this paper to transform the surface integrals into contour integrals allowing an efficient and systematic implementation of the procedure. Full derivations are presented for several lateral boundary conditions, including rectangular and circular metallic cavities and periodic structures. Numerical examples including the analysis of real-life planar boxed circuits are presented. In all cases the obtained results compare favourably with other existing techniques.