Friday, March 28, 2025

Replacement of obsolete FM WWW_GET_MIME_OBJECT

Recently I noticed that FM WWW_GET_MIME_OBJECT was marked as obsolete.


Thus, Code Inspector reports it in case it is used in custom ABAP coding.

Function module WWW_GET_MIME_OBJECT is flagged as obsolete. Send any queries to the developer of the ==> Function module WWW_GET_MIME_OBJECT.


I was looking for a replacement function. I found FM WWWDATA_IMPORT. This FM has even interface similar to the WWW_GET_MIME_OBJECT. Below I introduce a call of both the FMs.

 

WWW_GET_MIME_OBJECT call:

DATA:  picture TYPE TABLE OF w3mime,

       w3_queries TYPE TABLE OF w3query,

       w3_htmls TYPE TABLE OF w3html,

      return_code TYPE w3param-ret_code,

      content_type TYPE w3param-cont_type,

      content_length TYPE w3param-cont_len.

 

    INSERT VALUE #( name  = `_OBJECT_ID`

                    value = `Z_SMW0_ENTRY`) INTO TABLE w3_queries.

    CALL FUNCTION 'WWW_GET_MIME_OBJECT'

      TABLES

        query_string        = w3_queries

        html                = w3_htmls

        mime                = picture

      CHANGING

        return_code         = return_code

        content_type        = content_type

        content_length      = content_length

      EXCEPTIONS

        object_not_found    = 1

        parameter_not_found = 2

        OTHERS              = 3.

 

WWWDATA_IMPORT call:

  DATA mime TYPE w3mimetabtype.

 

  DATA(key) = VALUE wwwdatatab( relid = `MI`

                                objid = `Z_SMW0_ENTRY` ).

  CALL FUNCTION 'WWWDATA_IMPORT'

    EXPORTING

      key                    = key

   TABLES

     mime                    = mime

   EXCEPTIONS

     wrong_object_type       = 1

     import_error            = 2

     OTHERS                  = 3.


Other option would be to replicate the function that the FMs are doing. In nutshell what both the FM are doing is to read the table WWWDATA via IMPORT ABAP command. Something like this:

  DATA key TYPE w3mimetabtype.
  key-objid `Z_SMW0_ENTRY`.

  IMPORT mime FROM DATABASE wwwdata(mi) ID key.