Hi friends!!!
Have you ever felt the need of compressing large text or binary data in ABAP. I am sure whether or not you have come across it till now, it would prove to be very handy knowing how to do it. I can mention few example situations where you could use it. Suppose, you have large amount of text e.g. comments, notes etc. which need to be persisted in the database tables. Another example could be a case where you need to save a serialized object(instance) in the database which you later want to use.
Netweaver ABAP provides a service class CL_ABAP_GZIP to achieve this. This class has methods to compress as well as decompress text as well as binary data. I am briefly describing the methods of this class.
COMPRESS_TEXT:
This method is used to compress text data and get the compressed binary data. This method takes a character sequence (CHAR of any length, STRING etc.) input – TEXT_IN and returns compressed binary (XSTRING, RAW) output – GZIP_OUT.
DECOMPRESS_TEXT:
This method is used to de-compress compressed binary data and retrieve the text data back. This method takes a binary (XSTRING, RAW) input – GZIP_IN and returns character sequence (CHAR of any length, STRING etc.) output – TEXT_OUT.
COMPRESS_BINARY:
This method is used to compress binary data. This method takes a binary (XSTRING, RAW) input – RAW_IN and returns compressed binary (XSTRING, RAW) output – GZIP_OUT.
DECOMPRESS_BINARY:
This method is used to de-compress compressed binary data and retrieve the original binary data back. This method takes a binary (XSTRING, RAW) input – GZIP_IN and returns binary (XSTRING, RAW) output – RAW_OUT.
Soon, I will come back with more utilities in ABAP which make our lives easier. Till then, Cheers

