"Have a great sleep" is perfectly grammatical, in fact "have a great nap" is pretty common. However, "Have a good night's sleep" is really the more idiomatic way to say this. I suppose if we were to draw a distinction it would be the latter wished the sleeper not a short sleep, but one that lasted through the night. But that would be nit picky in the extreme.
Nobody would reasonably misunderstand or consider grammatically incorrect the first option. Consider for example people who work the night shift: how are we to wish them happy ZZZZs? "Have a great day's sleep?" Now that sounds odd.
Another expression that is pretty common and conveys the same sense is "sleep well!".