A novel formulation for analyzing scattering problems from two dimensional periodic structure consisting of inhomogeneous dielectric materials and metallic conductors has been proposed. The present method is a combination of the Fourier series technique and S-matrix method. Fourier series expansion technique is a popular method to deal with periodic structure problems consisting of dielectric materials and not including any perfect conductor with no-zero volume. The S-matrix method has recently proposed to analyze electromagnetic crystals consisting of discrete perfect conductors based on the mode-matching technique, in which the medium between two adjacent conductors must be homogenous. In order to overcome these difficulties, this paper will proposed a new formulation for analyzing electromagnetic problems of two dimensional periodic structure consisting of inhomogeneous dielectric materials and metallic conductors, by using Fourier series technique of sine and cosine function expansion, a window function, and S-matrix approach. The validity and fast convergence of the proposed method have been confirmed by a mass of numerical experimental.