MIME handling in SAP OData (File Media handling)

by | Jan 6, 2022 | ODATA

Home » SAP » ABAP » ODATA » 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.

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/SubcategoryFile ExtensionDescription
textstext/csscssCSS stylesheet file
text/htmlhtml, htmHTML file
text/javascriptjsJavaScript file
text/plaintxt, c, cc, g, h, hh, m, f90Plain text file
text/richtextrtxMIME rich text
text/xmlxmlXML file
Imagesimage/gifgifGIF graphic
image/iefiefExchange Format
image/jpegjpeg, jpg, jpeJPEG graphic
image/x-rgbrgbRBG graphic
image/x-windowdumpxwdX-Windows dump
image/tifftiff, tifTIFF graphic
image/bmpbmpIcon
image/icoicoIcon (Windows)
Audioaudio/basicau, sndAU and SND sound files
audio/x-aiffaif, aiff, aifcAIFF sound file
audio/x-aiffmidi, midMIDI file
audio/x-pn-realaudioram, raRealAudio file
audio/x-pn-realaudio-pluginrpmRealAudio plug-in file
Videovideo/mpegmpeg, mpg, mpeMPEG video
video/x-msvideoaviMicrosoft AVI video
video/x-sgi-moviemovieMicrosoft SGI video
video/quicktimeqt, movQuicktime video
Applicationsapplication/acad (NCSA)dwgAutoCAD file
application/dxf (CERN)dxfAutoCAD file
application/mifmifMaker Interchange Format (Adobe FrameMaker)
application/msworddoc, dotMS Word file
application/mspowerpointppt, ppz, pps, potMS PowerPoint file
application/msexcelxls, xlaMS Excel file
application/mshelphlp, chmMS Windows help file
application/octet-streamcom, exe, bin, dll, classExecutable file or program code file
application/pdfpdfPDF file (Adobe Acrobat Exchange/Reader)
application/postscriptai, eps, psPostscript file (Adobe)
application/rtfrtfRTF file (Microsoft)

 

Author

0 Comments

Submit a Comment

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.

Author