on 04-26-2016 2:52 PM
Dear Gurus,
I successfully implemented an SEGW project with SAP Annotations already, which is working properly and managing attachments. Now I want to do the same within a project of Vocabulary-based annotations.
I got the error: 415 (Unsupported Media Type). This is due I do not know, how-to configure the entity and its properties in SEGW to set this entity as Media Type, I feel myself a bit lost.
What I already did, is that redefined the DEFINE method of Model Provider to set up the Property holding the Content Type:
METHOD define.
super->define( ).
DATA(lo_entity_type) = model->get_entity_type( iv_entity_name = gc_attachment ).
IF lo_entity_type IS BOUND.
lo_entity_type->get_property( iv_property_name = 'MimeType' )->set_as_content_type( ).
ENDIF.
ENDMETHOD.
set IsMediaType for the MimeType property
set MediaType for the binary content
set allowed file extensions both in MimeType and Content properties
and set MediaResource configuration, but all unsuccessfully:
I wiped the cache and got the same issue time to time in the standard, when processing a newly created entities. The processing in the gateway is dependent of the following statement: lo_entity_type->has_stream( ), which is always false, and therefore the entity is evaluated not as a Media(and in metadata there is no HasStream attribute for my Attachment entity), and the exception 415 (Unsupported Media Type) is raised by the GateWay. Our release is GW 740sp11.
Any advise is welcome
Thank you
Hi Attila,
We would like to manage attachments within the same kind of projects.
And it's really tricky to find documentation on that topic.
Have you found any solutions for your Vocabulary-based annotation project?
Best regards,
Sophie
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sophie,
I found no documentation unfortunately. But complementing the above, you need to add the following statement in the redefinition of method DEFINE in the model provider (*MPC_EXT) class: lo_entity_type->set_is_media('X' ).
So the method looks like this:
METHOD define.
super->define( ).
DATA(lo_entity_type) = model->get_entity_type( iv_entity_name = gc_attachment ).
IF lo_entity_type IS BOUND.
lo_entity_type->set_is_media( iv_is_media = abap_true ).
lo_entity_type->get_property( iv_property_name = 'MimeType' )->set_as_content_type( ).
ENDIF.
ENDMETHOD.
Bets regards
Attila
P.S.:
I address the service using a sap.m.uploadcollection. If you need some snippets focusing on critical points (but not explaining the parts after the service received the data), you can find here, it will work with vocabulary based projects also.
Hi attila.berencsi,
Can you share your code a little bit, now I'm implementing a fiori app using service with vocabulary-based annotations and using UploadSet for uploading files, but it takes direct url to where files are stored, whiles service with vocabulary-based annotations is always sending $batch requests to backend, so I don't know how to apply UploadSet to service with vocabulary-based annotations.
It is very great, if you can share it!
Thanks & Best Regards,
Dinh Cuong Luc
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dinh Cuong Luc,
I've those snippets not anymore in my hands, they are gone with my old site into a database backup.
Sorry 😞
Bets regards, Attila
Hi,
I know this post is old but nowadays is also usefull 😉
I followed all the steps but I think I'm missing something because I'm trying to download my file by typing an URL like this ".../sap/opu/odata/sap/my_srv/AttachmentsSet('attachmentID')/$value" and I have the following error:
The request URI is not valid. The segment before '$value' must be a Media Link Entry.
Any suggestion? Thanks in advice.
PS: My Entity properties FILETYPE and FILECONTENT are configured as you say in your post. I've also redefined the "DEFINE" method from my "*MPC_EXT" class.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
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.