Homelab, Linux, JS & ABAP (~˘▾˘)~
 

[ABAP] Create DATA-URL from xstring

https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs

DATA lv_filetype TYPE char4.
DATA lv_content  TYPE xstring.

" get your data, for example a jpg
" lv_filetype = 'jpg'
" lv_content = ....

DATA(mimetype) = /iwwrk/cl_mgw_workflow_rt_util=>get_mime_type_from_extension( lv_filetype ).
DATA(base64)   = /iwwrk/cl_mgw_workflow_rt_util=>base64_encode( lv_content ).

DATA(lv_data_url) = |data:{ mimetype };base64,{ base64 }|.

[SAPUI5] Get Icon for MimeType

API Reference IconPool: https://sapui5.hana.ondemand.com/sdk/#/api/sap.ui.core.IconPool

In my case I used a custom formatter and the getIconForMimeType() function from the IconPool to get the required Icons for my list items.

myView.xml

icon="{path: 'mimeType', formatter: '.formatter.getIconForMimeType'}">

formatter.js

        getIconForMimeType: function(sMimeType) {
           return sap.ui.core.IconPool.getIconForMimeType(sMimeType)
        }