on 05-13-2016 7:31 AM
Hi Experts,
We have a requirement where we need to attach multiple files with different file extensions via Odata Service Call in GOS (no Z-table).
I know that we need to redefine method CREATE_STREAM to upload files.
Has anyone implemented such kind of a service where multiple files attached on UI side are read in a single service call and the files are uploaded in GOS?
From U5 side we are using Upload Collection Entity.
Hi Rahul,
For saving files in GOS ,we have SAP standard Class methods which need to be used. Is your question related to the backend filesave using GOS or the Gateway part how to.
Arka
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rahul,
Assuming you are seeking information on the gateway part, you can check the following steps:
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.
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
User | Count |
---|---|
88 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.