Skip to Content
0
Aug 13, 2015 at 11:26 AM

SAPUI5: Attachment Download functionality

2330 Views

Hello Experts,

I have a requirement to fetch the attachments into my SAPUI5 app. Below is the structure of the ODATA service that I will be using to achieve it.

<PATH>Attachment('<objectid>')

This will give me details about the attachment (like createdby, Name, DocumentLink, etc)

The document link will be used to download this attachment into the local system. Structure for this will be as below:

<PATH>Attachment('<objectid>')/Binary/$value

Before starting with this additional functionality, I want to understand how will I approach with this requirement. I can display the name of the attachment, but how will I trigger this download? Moreover when I test the attachment download Service, an attachment gets downloaded with the default file name as "value" without any extension to this file. So second hurdle I see how will manipulate to rename the TO BE DOWNLOADED file with it's actual name and it's actual extn?

Example, if the attachment name is My Attachment.pdf, it should be downloaded with it's original name (that is My Attachment.pdf), but it is downloaded as value (without extension)

Kindly help me understand this.

Thanks & Regards,

Chandan