abapsapscript

How to upload a BMP (or any other format) with transparent Background to SE78?


We need to upload images with transparent background to SE78 to use it in ABAP later to include them in automatically generated E-Mails. Currently they all have a background.

The problem is, currently 32-bit BMPs aren't supported in SE78, but anything below 32 bits doesn't support transparent background.

What else can we do to achieve this?

We load them currently in ABAP with class cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp and use that XSTRING, which works. But the E-Mail can be opened with Dark Mode, Light Mode or any other mode, so the Background must go.

What can we do?

I tried searching, but I don't find a solution to this, except it's just not supported, but there must be an alternative


Solution

  • You can add images as binary to your report. Maybe it is hard to update in future. Another alternative is using SAP Web Repository for images and other files.

    Go to SMW0 and create a mime object from your image and use below sample code to get it in your report.

        REPORT zmky_mime.
        
        DATA: lt_query          TYPE STANDARD TABLE OF w3query,
              lt_html           TYPE STANDARD TABLE OF w3html,
              lt_mime           TYPE STANDARD TABLE OF w3mime,
              lv_return_code    TYPE w3param-ret_code,
              lv_content_type   TYPE w3param-cont_type,
              lv_content_length TYPE w3param-cont_len.
        
        lt_query = VALUE #( ( name = '_OBJECT_ID' value = 'ZMKY_MIME' ) )
        
        CALL FUNCTION 'WWW_GET_MIME_OBJECT'
          TABLES
            query_string        = lt_query
            html_tabl           = lt_html
            mime                = lt_mime
          CHANGING
            return_code         = lv_return_code
            content_type        = lv_content_type
            content_length      = lv_content_length
          EXCEPTIONS
            object_not_found    = 1
            parameter_not_found = 2
            OTHERS              = 3.