Skip to Content
avatar image
Former Member

Mime logo not displaying

Hi all,

I have a mime logo in datbase as ''/SAP/BC/fp/graphics/PUBLIC/GRAPHICS/j7l/bcol/logo.png''. I want to display this logo in my webdynpro UI element.

For this I am changing this into xstring format and set the image with xstring attribute. But I cann't able to display the image. It displays as X at runtime.

Can any one suggest me how to displat this image. I am also providing you my code as below:

DATA lo_nd_logo TYPE REF TO if_wd_context_node.

DATA lo_el_logo TYPE REF TO if_wd_context_element.

DATA ls_logo TYPE wd_this->element_logo.

DATA lv_image TYPE wd_this->element_logo-image.

lo_nd_logo = wd_context->get_child_node( name = wd_this->wdctx_logo ).

lo_el_logo = lo_nd_logo->get_element( ).


lv_image = zcl_hrasr00_process_utilities=>get_logo( ).

Here LV_IMAGE have the Xstring data.

  • set single attribute


name = `IMAGE`

value = lv_image ).

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Apr 07, 2010 at 05:49 AM

    Refer this piece of code :

    DATA lo_el_context    TYPE REF TO if_wd_context_element.
      DATA ls_context       TYPE wd_this->element_context.
      DATA lv_search_pno    TYPE wd_this->element_context-search_pno.
      DATA lv_img           TYPE xstring.
      DATA r_url            TYPE string.
      DATA l_app_type       TYPE string.
      DATA guid             TYPE guid_32.
      DATA cached_response  TYPE REF TO if_http_response.
    *HERE  lv_img     has value in XSTRING fromat.*
      CREATE OBJECT cached_response
          add_c_msg        = 1.
    ****set the data and the headers
      cached_response->set_data( lv_img ).
      l_app_type = '.JPG'.
      cached_response->set_header_field( name  = if_http_header_fields=>content_type
                                         value = l_app_type ).
    ****Set the Response Status
      cached_response->set_status( code = 200 reason = 'OK' ).
    ****Set the Cache Timeout - 60 seconds - we only need this in the cache
    ****long enough to build the page  
      cached_response->server_cache_expire_rel( expires_rel = 60 ).
    ****Create a unique URL for the object
          ev_guid_32 = guid.
      CONCATENATE  '/sap/public' '/' guid '.' 'JPG' INTO r_url.
    ****Cache the URL
      cl_http_server=>server_cache_upload( url      = r_url
                                           response = cached_response ).
    * Set the value of image source
         name =  `IMAGEURL`	   value = r_url ).
    .IMAGEURL is the attribute binded to IMAGE UI element.

    Add comment
    10|10000 characters needed characters exceeded

    • >I have choose another option as saurabh suggested, but it will open a URL link and it will open a URL. Is there any way to set the height of this URL image.

      I believe you are not fully understanding the code sample provided. This code sample create a temporary URL for the image and uses this URl as the source property of the image UI element. It will work like any other Image UI element and display in place - not in a new window.

      However if you image is already in the MIME repository, why read it from the DB and put it into a temporary URL or try to force the XSTRING content into the image (the latter of which will NOT work). Everything in the MIME repository is already accessibility via URL. You just need to supply the URL for this path in the MIME as the source of your image.

  • avatar image
    Former Member
    Apr 09, 2010 at 10:30 AM

    I am closing this thread as I am not getting any information on this topic.

    If anyone come up with any suggestion, it will be very helpful for me as well as for others in future.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 05, 2010 at 09:51 AM

    Still need a solution

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Sanket,

      Although you have marked your query as answered, but it does not reflect whether you have got the issue resolved.

      I have used the same MIME way of displaying logo as well as Products Picture in WDA.

      The Steps were --

      1. Attach the pic as MIME.

      2. Go to the View, where you need to display that pic.

      3. Insert Element "IMAGE" in that view.

      4. In the Property Pane on the right hand side, Click in the SOURCE field. There comes a Help Popup Icon. Click on that.

      5. In that Popup, select "Component Images" Tab. There you would find all the pic(s), attached as MIME object in the MIME folder of your application. select as required.

      6. You can set Height & Width, if required.

      And its done.

      If its still not very clear, do raise the clarification points.


      Kumar Saurav.

  • avatar image
    Former Member
    May 05, 2010 at 05:10 PM

    Create a MIME object and import the logo in the component controller. Then go to main view and insert UI element type image

    and in properties tab->source select the image. Save and activate, then execute.

    Add comment
    10|10000 characters needed characters exceeded