Hi Rahul,
Assuming you are seeking information on the gateway part, you can check the following steps:
- Redefine the "DEFINE" method in your MPC_EXT and put the below code there:
super->define( ).
DATA:
lo_entity TYPE REF TO /iwbep/if_mgw_odata_entity_typ,
lo_property TYPE REF TO /iwbep/if_mgw_odata_property.
lo_entity = model->get_entity_type( iv_entity_name = <Your Entity Name>).
IF lo_entity IS BOUND.
lo_property = lo_entity->get_property( iv_property_name = 'Mimetype' ).
lo_property->set_as_content_type( ).
ENDIF.
- As you have mentioned redefine the CREATE_STREAM method in your DPC_EXT and put the following code
CASE iv_entity_name.
WHEN <Your Entity>.
ls_upload-mimetype = is_media_resource-mime_type.
ls_upload-filename = iv_slug.
ls_upload-value = is_media_resource-value.
Call the GOS method here to save the attachment. LS_UPLOAD used here is a local structure with only the below fields.
FILENAME - CHAR200
VALUE - XSTRINGVAL
MIMETYPE- CHAR100
LS_FILE used here is of type your entity.
<your entity>set_get_entity(
EXPORTING
iv_entity_name = iv_entity_name
iv_entity_set_name = iv_entity_set_name
iv_source_name = iv_source_name
it_key_tab = it_key_tab
it_navigation_path = it_navigation_path
IMPORTING
er_entity = ls_file ).
copy_data_to_ref( EXPORTING is_data = ls_upload
CHANGING cr_data = ER_ENTITY ).
ENDCASE.
From UI pass the attachements one by one by calling the entity set (method "POST") and passing the filename in the slug parameter of the http request.
Hope this helps.
Arka