Y-G algorithm is used in the whole desigh of a new type phase-only-controlled wave length division multiplexer (WDM). According to the intensity distribution set up on the input (H1) and output(H2) faces, the phase distribution on H1 and H2 can be designed. By only phase modulation, The demultiplex and focusing etc. are realized, thus the WDM structure is simplified, and at the same time the Y-G algorithm is extende to the situation that the input beam is a 2-D Gaussian beam and the output beam is also a 2-D Gaussian beam.