This question may be answered with a 'yes' and a 'no'. For the answer to this question depends on the meaning that is implied when it is said that a book has been compiled. If by the compilation of a book one has in mind the idea of his followers being told clearly as to which the chapters are from the beginning to the end and which the verses in each of them are and of making a good number of his followers to memorize it, then it may be said that the Qur'an had been compiled during the time of Muhammed (pbuh) itself. But if by compilation is meant the stitching together of all the chapters and binding them between two cover pages and then publishing it, it may then be said that the Qur'an was not compiled during the time of Muhammad (S.A.W).
The fact is that it was impossible to compile the Qur'an in the life time of the Prophet. We know of the style in which the Qur'an was revealed. Gabriel comes, recites the verses of the Qur'an, instructs as to which chapter and which position it is to fit. This was the usual procedure. Since the verses, which were revealed according to various circumstances, were not compiled as chapters in the chronological order of their revelation, the Qur'an could be said to have been fully compiled as a book only after the last verse had been revealed. The last of the verses of the Qur'an was revealed just nine days before to death of the Prophet. It need not be emphasized that the compilation of the Qur'an within these nine days would have been a very difficult task. It would be correct, therefore, to say that the Prophet did not see the compilation of the Qur'an as an important matter considering the fact that many of his followers had completely memorized it and that it was written down in its entirety on sheets of leather and other such materials and that above all else, the Lord Creator Himself had assured the responsibility of protecting the Qur'an.