An extension of the periodic FEM/BEM analysis technique is proposed and its application to P-matrix computation for periodic grating structures is described. Conventional BEM is extended to include waves propagating in opposite directions. The FEM part is extended to include power flow through the periodic boundaries, where the fields are expressed as linear combinations of known propagating modes. The modes for the given device structure can be calculated by the conventional FEM/BEM analysis. The action integral for the FEM is given in which the displacement and the electrostatic potential are treated as complex fields. It is shown, based on Noether's theorem, that the power flow through the boundaries derived from the given action integral is described by surface integral of the Poynting vector. P-matrix elements can be obtained as part of solutions for the combined FEM/BEM equations.