A novel heuristic algorithm that considers transmission impairment (especially amplified spontaneous emission (ASE) noise) is developed for traffic grooming in wavelength division multiplexing (WDM) optical networks. Span constraints, which are determined by the impairment, are added to constrain the maximal transparent reach limit of a lightpath. Under span constraints, a series of short lightpaths will be built up explicitly to relay traffic when a single lightpath cannot meet the requirement of transmission quality. Both problem formulations and heuristic algorithms are given for impairment-aware traffic grooming. Numerical results show that the successful routing of each low-speed traffic stream is guaranteed and the efficiency of wavelength channels and lightpath usage are both improved by considering transmission impairment.