Skip to Content
0
Jan 13 at 10:43 AM

Odata get_stream for download doesnt work

76 Views

I have an oData service for File Download functionality. I have to include $value parameter to oData call to trigger GET_Stream at backend.

I see when I set a external breakpoint on get_stream method, that the method is triggered. But the file download doesnt work. I get a http response 200 which means it is all ok but I dont see any data or row of information.

So in ls_stream there should two columns (column1 and cloumn2)
One of the columns is assigned the correct value and the other is empty.

To the variable Ls_stream-mimetype the value 'pdf' is correctly assigned

To the variable ls_stream-value, the value for this is not assigned it is still empty

My redefined methods are:
_DPC_EXT:
/IWBEP/IF_MGW_APPL_SRV_RUNTIME~GET_STREAM
FileSET_GET_ENTITYSET

_MPC_EXT:

DEFINE

METHOD /iwbep/if_mgw_appl_srv_runtime~get_stream.
DATA: ls_stream TYPE
/iwbep/if_mgw_appl_types=>ty_s_media_resource,
ls_entity TYPE zcl_ebi_billing_doc_mpc=>ts_attachment,
ls_images TYPE toa01,
lt_images TYPE TABLE OF toa01,
l_wa_document_data TYPE sofolenti1,
lt_cont_hex TYPE TABLE OF solix,
lv_xstring TYPE xstring,
ls_lheader TYPE ihttpnvp,
lv_filename TYPE string,
lv_length TYPE i,
lt_data TYPE TABLE OF tbl1024,
ls_archive TYPE toa01,
lv_attachment TYPE saeardoid,
lv_doctype TYPE saearoname,
wa_test TYPE toa01.


FIELD-SYMBOLS:<fs_key> TYPE /iwbep/s_mgw_name_value_pair.
READ TABLE it_key_tab ASSIGNING <fs_key> INDEX 1.
lv_attachment = <fs_key>-value.


SELECT SINGLE * FROM toa01 INTO CORRESPONDING FIELDS OF ls_archive WHERE
arc_doc_id = lv_attachment.


if ls_archive is not initial.
"Now copy the binary data
ls_stream-value = ls_archive-arc_doc_id.
ls_stream-mime_type = ls_archive-reserve.
copy_data_to_ref( exporting is_data = ls_stream
changing cr_data = er_stream ) .<br>