Skip to Content

Exporting params on CL_ABAP_GZIP_TEXT_STREAM->SET_OUT_BUF

Just using this class to compress some data. All fairly straightforward, but why are the parameters on set_out_buf exporting rather than importing?

Looking at the code inside, it looks like it sets the reference to the buffer, rather than getting it.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    May 23 at 05:47 AM

    It's very important otherwise that would make the passed data object as READ-ONLY from inside the GZIP class, and there would be a short dump when it's filled out by SAP during the COMPRESS_* methods. SAP could have written the method with an Importing parameter by receiving the REFERENCE to the buffer data object (matter of style).

    Add comment
    10|10000 characters needed characters exceeded

  • May 22 at 09:22 PM

    The following long text documentation explains it on my system. It looks like a fancy way to save programmers from using those nasty reference thingies.

    Class Method CL_ABAP_GZIP_TEXT_STREAM=>SET_OUT_BUF

    Functionality
    The method SET_OUT_BUF makes the output buffer OUT_BUF with the length OUT_BUF_LEN available (but it does not fill it – this is done by the method COMPRESS_BINARY_STREAM[_END]). The length is a restriction for the output buffer (including XSTRING). The length specification –1 means that this is the total length for an X field and unrestricted length for an XSTRING. The length of the buffer must be at least 8 (bytes) to store the administration data.

    Parameters

    - OUT_BUF Specification of the output buffer (X field or XString)
    - OUT_BUF_LEN Optional length specification of the buffer (default –1)

    Exceptions

    - CX_PARAMETER_INVALID_RANGE If the OUT_BUF_LEN is shorter than 8 (bytes) or too large for the specified OUT_BUF

    Add comment
    10|10000 characters needed characters exceeded