How to retrieve Mime Type of File in ABAP ? ( SAP Mime Types Tables)

This article will guide through how to retrieve Mime Type of any file using ABAP Program.

First, let’s deal with some definition ( what’s mime type ? ). Then we will list the most important tables in SAP for MimeTypes.
The last part will cover how to retrive, for a particular file, the mime type using standard SAP functions.

What’s MimeType ?

A media type (also MIME type and content type) is a two-part identifier for file formats and format contents transmitted on the Internet.
Media type consists of top-level type name and sub-type name, which is further structured into so-called “trees”. Media types can optionally define companion data, known as parameters.(1)

top-level type name / subtype name [ ; parameters ]
top-level type name / [ tree. ] subtype name [ +suffix ] [ ; parameters ]

Read also Sample ABAP Program for Application server File

List of Standard MimeType in SAP ?

First, let’s list the main SAP Tables for MimeTypes:

Table Description
MIMETYPES Table of MIME types
SDOKMIME MIME content type for file name enhancement
SDOKMIME_C MIME content type for file name enhancement (customer table)
SDOKMIMS MIME Content Type Replacement for Display/Editing
SDOKMIMS_C MIME Content Type Replacement (Customer Table)

SAP Mime Type Table MIMETYPES

The table in SAP for Mime Type is MIMETYPES.
MIMETYPES: Table of MIME types.

It has 2 fields:

  • TYEPE: HTML Content Type
  • EXTENSION: file name Extension

SDOKMIME SAP Mime Type Table

In the above table (MIMETYPES) is empty in your SAP System. Check the SAP Table SDOKMIME.
It has the same fields.

List of MimeType in SAP

All the mime Type description can be found in SAP Table SDOKFEXTT ( Text Table for SDOKFEXT ).

For example, for SAP MimeType “text/plain”, the description will be “Plain Text”

SAP Mime Type Description Table SDOKFEXTT

Extension SAP Mime Type
ai application/postscript
aif audio/x-aiff
aifc audio/x-aiff
aiff audio/x-aiff
asc text/plain
asf video/x-ms-asf
asp text/asp
asx video/x-ms-asf
au audio/basic
avi video/avi
bmp image/bmp
bsp text/html
btf image/prs.btif
btif image/prs.btif
c text/plain
cc text/plain
cgm image/cgm
cpp text/plain
css text/css
dcr application/x-director
der application/x-x509-ca-cert
doc application/msword
docm application/vnd.ms-word.document.macroenabled.12
docx application/vnd.openxmlformats-officedocument.wordprocessingml.document
dot application/msword
dotm application/vnd.ms-word.template.macroenabled.12
dotx application/vnd.openxmlformats-officedocument.wordprocessingml.template
dtd text/xml
dvi application/x-dvi
eps application/postscript
fpx image/vnd.fpx
gif image/gif
gz application/x-gzip
h text/plain
hh text/plain
hlp application/winhelp
hpp text/plain
htm text/html
html text/html
ico image/ico
ics text/calendar
ief image/ief
iges model/iges
igs model/iges
ini text/plain
jar application/java-archive
jpe image/jpeg
jpeg image/jpeg
jpg image/jpeg
js application/x-javascript
jsp text/html
latex application/x-latex
mesh model/mesh
mid audio/mid
midi audio/mid
mif application/mif
mov video/quicktime
mp3 audio/mpeg
mpe video/mpeg
mpeg video/mpeg
mpf text/vnd.ms-mediapackage
mpg video/mpeg
mpp application/vnd.ms-project
mpx application/vnd.ms-project
msh model/mesh
oda application/oda
p7m application/pkcs7-mime
p7s application/pkcs7-signature
pdf application/pdf
pl application/x-perl
png image/png
potm application/vnd.ms-powerpoint.template.macroenabled.12
potx application/vnd.openxmlformats-officedocument.presentationml.template
ppa application/vnd.ms-powerpoint
ppam application/vnd.ms-powerpoint.addin.macroenabled.12
pps application/vnd.ms-powerpoint
ppsm application/vnd.ms-powerpoint.slideshow.macroenabled.12
ppsx application/vnd.openxmlformats-officedocument.presentationml.slideshow
ppt application/vnd.ms-powerpoint
pptm application/vnd.ms-powerpoint.presentation.macroenabled.12
pptx application/vnd.openxmlformats-officedocument.presentationml.presentation
ppz application/vnd.ms-powerpoint
ps application/postscript
qt video/quicktime
ra audio/x-pn-realaudio
ram audio/x-pn-realaudio
rgb image/x-rgb
rm audio/x-pn-realaudio
rtf application/rtf
rtx text/richtext
sap application/x-sapshortcut
scm application/x-screencam
silo model/mesh
sim application/vnd.sap_kw.itutor
sit application/x-stuffit
sl text/vnd.wap.sl
snd audio/basic
spl application/x-futuresplash
svg image/svg+xml
swa application/x-director
swf application/x-shockwave-flash
tar application/x-tar
tex application/x-tex
tht text/thtml
thtm text/thtml
thtml text/thtml
tif image/tiff
tiff image/tiff
tsf application/vnd.ms-excel
txt text/plain
vcf text/x-vcard
vcs text/x-vcalendar
vdo video/vdo
viv video/vnd.vivo
vrml model/vrml
vsd application/vnd.visio
wav audio/x-wav
wbmp text/vnd.wap.wbmp
wmf application/x-msmetafile
wml text/vnd.wap.wml
wmls text/vnd.wap.wmlscript
wp5 application/wordperfect5.1
wrl model/vrml
xap application/x-silverlight-app
xbm image/x-xbitmap
xif image/vnd.xiff
xlam application/vnd.ms-excel.addin.macroenabled.12
xls application/vnd.ms-excel
xlsb application/vnd.ms-excel.sheet.binary.macroenabled.12
xlsm application/vnd.ms-excel.sheet.macroenabled.12
xlsx application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
xltm application/vnd.ms-excel.template.macroenabled.12
xltx application/vnd.openxmlformats-officedocument.spreadsheetml.template
xml text/xml
xsd text/xml
xsl text/xml
zip application/x-zip-compressed

How to retrieve Mimetype of a file in ABAP ?

In standard, SAP offers different function module to retrieve the Mime Type of a file in ABAP.

Let’s list the most used ones:

SKWF_MIMETYPE_OF_FILE_GET

The first function module is SKWF_MIMETYPE_OF_FILE_GET. It takes the filename in input and generates the Mime Type as output.
Here the signature of SKWF_MIMETYPE_OF_FILE_GET.

Others SAP function for MimeType

Here we list other interesting functions in SAP for MimeType:

  • SDOK_MIMETYPE_GET_DESCRIPTION : Get MimeType Description
  • LXE_PC_READ_MIMETYPES : Definierte MIME-Types lesen
  • LXE_TS_API_GET_TS_MIMETYPES : Get a list of supported MIME types
  • SA_KW_RFC_MIMETYPE_GET
  • SMD_RFC_MIMETYPE_GET : ad mimetype from file extension

Note that this function module will retrieve the extension of the file, then it will call the SDOK_MIMETYPE_GET.

(1): Media Type in Wikipedia

SAP and SAP logo are registered trademarks of SAP AG. Sap4tech.net is not associated with SAP AG.
We have made every effort to make sure provide relevant search results, use the content on this site at your own risk.

We are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to Amazon.com and affiliated sites.