How to compress data in ABAP using CL_ABAP_ZIP?

Sometimes size of the document that is to be handed to user may be large.

For example, this may be the case when some report result is saved in CSV or XML format. How to make the resulting file smaller in ABAP? One solution can be to compress the data using ZIP compression.

Below I present an example: