Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Can someone explain attachment handling in Fiori/SAPUI5

We're working right now on a Fiori app and we want to show attachment files. That's I've investigated the "Approve Purchase Order". As far as I understand the ODATA Service delivers only metadata information.

<EntityType Name="Attachment" m:HasStream="true" sap:content-version="1">


<PropertyRef Name="AttachmentGuid" />


<Property Name="AttachmentGuid" Type="Edm.String" Nullable="false" MaxLength="46" />

<Property Name="PrNumber" Type="Edm.String" MaxLength="10" sap:label="Objekt-ID" />

<Property Name="ItemNumber" Type="Edm.String" MaxLength="5" sap:label="Zeilen-ID" />

<Property Name="Description" Type="Edm.String" MaxLength="40" sap:label="Beschreibung" />

<Property Name="FileName" Type="Edm.String" MaxLength="255" sap:label="Komponentenname" />

<Property Name="MimeType" Type="Edm.String" MaxLength="128" sap:label="MIME Typ" />

<Property Name="FileSize" Type="Edm.String" MaxLength="12" />

<Property Name="CreatedByID" Type="Edm.String" MaxLength="12" sap:label="Benutzername" />

<Property Name="CreatedByName" Type="Edm.String" MaxLength="40" sap:label="Char" />

<Property Name="CreatedAt" Type="Edm.DateTime" Precision="0" sap:label="Zeitstempel" />


This information is shown in a StandarListItem. The "press" action is "onAttachment" and here is the (few) code lines:

onAttachment: function(oEvent) {
   var oContext = oEvent.getSource().getBindingContext();
   var sMediaSrc = oContext.getProperty().__metadata.media_src;
   sap.m.URLHelper.redirect(sMediaSrc, false);


I have no idea hiw it works. What is "__metadata.media_src" and where is it defined? I would expect at least the file name here.

Former Member
Former Member replied

In the meantime I've found a got blog regarding to this topic. It explains all of my questions.

How to Read Photo from SAP system using SAP Gateway

As you can see in this blog you will get this special "media_src" metadata field if you mark the "media" option on your entity definition in SEGW. But you have to implement get_stream in this case.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question