How to Retrieve Attachment with GW ?
The OData Channel provides a generic solution for exposing binary data that is stored in an SAP Business Suite backend system and should be accessible using a media link entry.
Here the definition of the DPC method /IWBEP/IF_MGW_APPL_SRV_RUNTIME~GET_STREAM in order to retrieve the media.
Also, you will find some useful sample of GET_STREAM method implementation.