cancel
Showing results for 
Search instead for 
Did you mean: 

Media type entity ABAP Restful Programming Model

SumitKundu
Active Participant
2,734

In ABAP Restful Programming Model, how should the media type entity be declared?

In ABAP Programming model for Fiori, we can implement CREATE_STREAM, GET_STREAM in code based implementation of the DPC_EXT class. What is the equivalent approach in RAP?

ravi_rajput
Participant
0 Kudos

We were dealing with object store where we need to store word doc, pdf, excel, We used Custom entity to handle the data in base64 format in RAP.

Also it was a freestyle application and not template- based. Hope it helps.

0 Kudos

Hi Sumit,

Were you able to achieve media handling in on-premise using RAP model?

SumitKundu
Active Participant
0 Kudos

Heven't tried it yet but I thought of custom entity to achieve this.

View Entire Topic
maheshpalavalli
Active Contributor

Hi sumit.kundu2 ,

From my understanding, it is not supported. SAP created attachment service for this specific reason and for reusability.

https://blogs.sap.com/2019/12/16/attachment-service-to-your-rescue-in-s4hana-fiori-elements-using-re...

Any reason you want to provide stream option in rap entity?

-Mahesh

SumitKundu
Active Participant
0 Kudos

Thanks maheshkumar.palavalli . Yes attachment reuse component is an option(enjoyed reading your blog post already,btw 🙂 ). I am just exploring the options in RAP. An example use case could be an employee BO entity with employee photo displayed in the object page (could be an avatar control). Just wondering what are the equivalent options of uploading an image using only ABAP in such a scenario in RAP.

Regards,

Sumit

maheshpalavalli
Active Contributor
0 Kudos

Hi sumit.kundu2

Thanks man 🙂

I believe the best way to do this is to use ABAP Virtual Elements. and populate the URL dynamically instead of the xstring data. This URL can be your stream URL from a normal odata service or it can be a URL generated by standard FMs.

I've observed this same behaviour with standard apps as well.

For ref. code to generate URL, check the ref. code.

cl_document_thumbnail_api=>get_instance( )->get_document_thumbnail(
EXPORTING iv_objecttype = ‘MARA’
 iv_objectkey = lv_object_key 
 iv_get_url_only = abap_true
IMPORTING 
 ev_mimetype = lv_mimetype 
 ev_thumbnail_url = lv_thumbnail_url ).

Regard,

Mahesh

0 Kudos

Hi Mahesh,

I have used the attachment service as mentioned in your blog. It works perfectly for all document types except for .msg(outlook mail). Any hint how to resolve it? It do not give me any error message while selecting .msg file, it just doesn't add to the attachment list

Thanks

Shabnam

maheshpalavalli
Active Contributor
0 Kudos

shabnamjalal , I didn't try this scenario :(. You can raise a new question in the community for a better visibility and also did u try debugging and see why it is failing (I know it's a very lengthy process, considering that it's all standard sap classes, but it will be worth a try if you want to figure this out quickly)