Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
arnabdatta3
Participant
Hi folks,

Sometimes, due to some UI framework limitation or requirements you may need to return the file content through OData with GET method only. You can do that in the below way.

Define the entity as below. Do not mark it as media.


Define attributes as below.


While, returning the data from XXXXXX_GET_ENTITY method, implement the logic to get the file content from table/BOFP objects and after that use the below code to convert it to BSEE 64 string.

 
lv_content = rr_s_content->content .

CALL FUNCTION 'SCMS_BASE64_ENCODE_STR'
EXPORTING
input = lv_content
IMPORTING
output = lv_pdf_string.

er_entity-content = lv_pdf_string.
er_entity-mimetype = rr_s_content->mime_code.
er_entity-filename = rr_s_content->file_name.

 

This will return the file content in Base64 encoding which can be consumed by the UI library and make it downloadable for the user.

Happy coding!! 🙂
Labels in this area