MIME handling in SAP OData (File Media handling)

Preface – This post is part of the SAP ABAP OData Tutorial series.

This article will give a bare minimum to read and upload media files or MIME in SAP OData service.

Table of Contents

Procedure

  1. Create OData service
  2. Register service
  3. Execute service

Steps

  1. Create OData
  2. Select EntityType and select checkbox ‘Media’
    Enable MIME in OData
  3. Generate runtime artifact. In MPC ext class redefine the DEFINE method.
    Generate MIME runtime artifact ODATA
  4. Redefine method /IWBEP/IF_MGW_APPL_SRV_RUNTIME~CREATE_STREAM .
    Create Stream
  5. Redefine method /IWBEP/IF_MGW_APPL_SRV_RUNTIME~GET_STREAM .
    Get Stream
  6. Redefine method /IWBEP/IF_MGW_APPL_SRV_RUNTIME~UPDATE_STREAM .
    Update Stream

 

  1. Redefine method FILESET_GET_ENTITYSET.
    FILESET_GET_ENTITYSET
  2. Register OData service
  3. Execute
    1. GET_STREAM is used to download the media
    /sap/opu/odata/sap/ZMIMEFILE_SRV/File(Mandt=’100′,Filename=’mobile.jpg’)/$value.
    Download the media
     

    2. CREATE_STREAM is used to upload the media
    /sap/opu/odata/sap/ZMIMEFILE_SRV/File
    Upload the media

 

Features

List of supported MIME Types that can be stored in MIME Repository:

Category/Subcategory File Extension Description
texts text/css css CSS stylesheet file
text/html html, htm HTML file
text/javascript js JavaScript file
text/plain txt, c, cc, g, h, hh, m, f90 Plain text file
text/richtext rtx MIME rich text
text/xml xml XML file
Images image/gif gif GIF graphic
image/ief ief Exchange Format
image/jpeg jpeg, jpg, jpe JPEG graphic
image/x-rgb rgb RBG graphic
image/x-windowdump xwd X-Windows dump
image/tiff tiff, tif TIFF graphic
image/bmp bmp Icon
image/ico ico Icon (Windows)
Audio audio/basic au, snd AU and SND sound files
audio/x-aiff aif, aiff, aifc AIFF sound file
audio/x-aiff midi, mid MIDI file
audio/x-pn-realaudio ram, ra RealAudio file
audio/x-pn-realaudio-plugin rpm RealAudio plug-in file
Video video/mpeg mpeg, mpg, mpe MPEG video
video/x-msvideo avi Microsoft AVI video
video/x-sgi-movie movie Microsoft SGI video
video/quicktime qt, mov Quicktime video
Applications application/acad (NCSA) dwg AutoCAD file
application/dxf (CERN) dxf AutoCAD file
application/mif mif Maker Interchange Format (Adobe FrameMaker)
application/msword doc, dot MS Word file
application/mspowerpoint ppt, ppz, pps, pot MS PowerPoint file
application/msexcel xls, xla MS Excel file
application/mshelp hlp, chm MS Windows help file
application/octet-stream com, exe, bin, dll, class Executable file or program code file
application/pdf pdf PDF file (Adobe Acrobat Exchange/Reader)
application/postscript ai, eps, ps Postscript file (Adobe)
application/rtf rtf RTF file (Microsoft)

 

Author

  • Barry Allen

    A Full Stack Developer with 10+ years of experience in different domain including SAP, Blockchain, AI and Web Development.


Comments

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.