cancel
Showing results for 
Search instead for 
Did you mean: 

Attachment Download using standard c4codata service in UI5

Former Member
0 Kudos

Hi,

We have a scenario in which we want to download attachments from Service Requests stored in the SAP C4C system as attachment on our UI5 application using the standard odata i.e c4codata service.

Currently when trying to download the attachment using the url we get a $value file instead of the actual file with the extension.

I have attached screenshots for reference.

I think its due to the Binary field before the $value in the link . Tried to add the Binary value between the $value and still it doesn't work.

Any suggestions would be appreciated.

former_member190818
Active Contributor
0 Kudos

Hello Kaustabh,

Did you find a way to achieve this requirement? Even we have the same scenario.

Regards,

MB

Accepted Solutions (0)

Answers (1)

Answers (1)

vinod_kannur88
Explorer
0 Kudos

Hi,

Try using $expand=ServiceRequestAttachmentFolder to get the binary attribute passed in your odata service.

The category code 2 ( document), binary content will be passed. For category 3( link or Library), you need to use LinkWebURI attribute.

This is an example of odata service which would return you with binary content:

https://xxx.ondemand.com/sap/c4c/odata/v1/c4codata/ServiceRequestCollection?$expand=ServiceRequestAt...

This is how odata would return if you have category code with Link:

<d:Binary/>
<d:CategoryCode>3</d:CategoryCode>
<d:CategoryCodeText>Link</d:CategoryCodeText>
<d:CreatedBy>John Healy</d:CreatedBy>
<d:CreatedOn>2018-05-23T14:24:15.9133190</d:CreatedOn>
<d:DocumentLink/>
<d:ETag>2018-05-23T14:25:14.0577470Z</d:ETag>
<d:LastUpdatedBy>John Healy</d:LastUpdatedBy>
<d:LastUpdatedOn>2018-05-23T14:25:14.0577470</d:LastUpdatedOn>
"); vertical-align: bottom; height: 10px;"><d:LinkWebURI>
https://xx.crm.ondemand.com/sap/XXX/00163E23E5051EE88CB14ED39BEAD0A7/CBA.pdf?sap-client=100
</d:LinkWebURI>
<d:MimeType/>