Learn how to upload attachment in Fiori Application

In this tutorial will be learning how to update the data model of the base RAP BO to support handling large objects (LOBs, or OData streams) in your Fiori elements app. This will allow your end-users to upload and download images directly within your Travel app.

Open your Root Entity ZR_RAPTECH_TRAVEL
For element MimeType:
@Semantics.mimeType: true
For element Attachment:
@Semantics.largeObject: { mimeType: 'MimeType',   //case-sensitive
                            fileName: 'FileName',   //case-sensitive
                            acceptableMimeTypes: ['image/png', 'image/jpeg'],
                            contentDispositionPreference: #ATTACHMENT }
Here is the short explanation of above annotation
mimeType: Specifies the field that contains the MIME type of the object. ⚠ The value is case-sensitive.
fileName: Specifies the field that contains the file name of the MIME object. ⚠ The value is case-sensitive.
acceptableMimeTypes: Lists the acceptable MIME types for the related stream property, helping to restrict or validate user input accordingly. Use * to indicate that any subtype is accepted.
contentDispositionPreference: Defines whether the content should be displayed inline in the browser (e.g., as a web page or part of a web page) or treated as an attachment (i.e., downloaded and saved locally).
Save and activate the changes. Refresh browser and upload png or jpeg documents.
You have successfully completed beginner’s tutorial on how to upload attachment.

Leave a Comment

Your email address will not be published. Required fields are marked *