Hi,
I have created an OData service for File Upload and Download.
I have created 2 tables i.e. 1st Table contains contact information and 2nd table contains the attachment. The Ref_ID field is the primary key in both tables. Using the same Tables I have created the below two Entity Types with Association/Navigation Between Them. I have marked the Second Entity as Media Type
Entity 1:
Entity 2:
I have Implemented the Create Stream Method as below:
DATA: ls_key_tab TYPE /iwbep/s_mgw_name_value_pair,
lt_key_tab TYPE /iwbep/t_mgw_name_value_pair,
ls_info TYPE ZBASIC_CONT_FILE,
lv_refid TYPE zref_id.
CASE iv_entity_name.
WHEN 'ZBASIC_CONT_POA_FILE'.
READ TABLE it_key_tab WITH KEY name = 'RefID' INTO ls_key_tab.
SELECT SINGLE * FROM zbasic_cont_file INTO CORRESPONDING FIELDS OF ls_info WHERE ref_id = ls_key_tab-value.
ls_info-ref_id = ls_key_tab-value.
ls_info-poa_mtype = is_media_resource-mime_type.
ls_info-poa = iv_slug.
ls_info-poa_content = is_media_resource-value.
MODIFY zbasic_cont_file FROM ls_info.
copy_data_to_ref( EXPORTING is_data = ls_info
CHANGING cr_data = er_entity ).
ENDCASE.
While I executing the URL as below with Content-Type = application/atom+xml everything seems to be fine whereas when i set the Content-Type = application/pdf or any thing elsee eror is triggered as in below screenhot.
Error Screen:
Sucess Screen with Content Type as application/atom+xml
Kindly help to understand What am i doing wrong.
I have followed the Blog
Thanks in advance,
Samir