cancel
Showing results for 
Search instead for 
Did you mean: 

GUID for MIME image

former_member187452
Contributor
0 Kudos

Hi All,

Can you please let me know how to GUID for MIME Image.


lo_mime = cl_mime_repository_api=>get_api( ) .

lo_mime->get( EXPORTING  i_url = '/sap/bc/webdynpro/sap/zdemo/logo.png'
                      IMPORTING  e_content = xstring.

from this I get the xstring value of the MIME Image


image->src = upload_resource( iv_data = xstring
                                               iv_content_type = 'image/png'
                                               iv_guid = lv_guid) .

lv_guid = GUID of MIME image.

lv_guid will have the GUID of the MIME image.

Can you please let know how to find its GUID.

Thanks,

Bharat

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Bharat,

You will need to create the GUID using FM GUID_CREATE.

Hope this code helps you which converts xstring to image for use in WD:

DATA: guid TYPE guid_32,

         cached_response TYPE REF TO if_http_response,

         lv_xstring TYPE xstring.

   I called a custom FM and got the xstring of image in lv_xstring

* Create URL from XSTRING of photo

   CREATE OBJECT cached_response

     TYPE

     cl_http_response

     EXPORTING

       add_c_msg = 1.

* set image to mime

   cached_response->set_data( lv_xstring ).

   cached_response->set_header_field(

   name = if_http_header_fields=>content_type

   value = 'image/pjpeg' ).

   cached_response->set_status( code = 200 reason = 'OK' ).

   cached_response->server_cache_expire_rel( expires_rel = 600 ).

  CALL FUNCTION 'GUID_CREATE'

     IMPORTING

       ev_guid_32 = guid.

   CALL METHOD cl_wd_utilities=>construct_wd_url

     EXPORTING

       application_name = <WD-application name>

     IMPORTING

       out_local_url    = ex_url.

   CONCATENATE ex_url '/' guid sy-uzeit INTO ex_url.

   CALL METHOD cl_http_server=>server_cache_upload

     EXPORTING

       url      = ex_url

       response = cached_response.

former_member187452
Contributor
0 Kudos

Hi Manish,

Thanks for your reply.

I have tried using the FM GUID_CREATE but still the image was not getting displayed.

So is there any other way to find GUID of MIME image?

Thanks,

Bharat

Answers (2)

Answers (2)

former_member210804
Active Participant
0 Kudos

Hi Bharat,

Kindly refer the below link

http://scn.sap.com/thread/3322844

matteo_montalto
Contributor
0 Kudos

How did you upload your MIME image?
If the image is a GRAPHICS one (BMAP, i.e.) uploaded/submitted to the system via SE78 transaction, then its reference could be found in table STXBITMAPS:

SELECT SINGLE *

INTO  lwa_stxbitmaps

FROM  stxbitmaps

WHERE tdobject = 'GRAPHICS'

AND   tdname   = your_own_image_name

AND   tdid     = 'BMAP'.

DOCID field returns a reference which is a concatenation of a prefix and GUID.

former_member187452
Contributor
0 Kudos

Hi,

Thanks for your reply.

I have uploaded the image through MIME repository in SE80.

The image is stored in the same path as that of my Webydnpro application.

Any idea how to get the GUID of this?

Thanks,

Bharat.