cancel
Showing results for 
Search instead for 
Did you mean: 

Mime logo not displaying

Former Member
0 Kudos

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( ).

  • BREAK-POINT.

lv_image = zcl_hrasr00_process_utilities=>get_logo( ).

Here LV_IMAGE have the Xstring data.

  • set single attribute

lo_el_logo->set_attribute(

name = `IMAGE`

value = lv_image ).

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

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.

Former Member
0 Kudos

Still need a solution

Former Member
0 Kudos

Hi

Saurabh's code doesn't open a new window if that's what you mean.

As for the height and width you could try setting these properties in the image UI element.

former_member186491
Contributor
0 Kudos

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.

Thanks.

Kumar Saurav.

Former Member
0 Kudos

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.

Former Member
0 Kudos

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
    TYPE
      cl_http_response
    EXPORTING
      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
  CALL FUNCTION 'GUID_CREATE'
    IMPORTING
      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
  lo_el_context->set_attribute(
     name =  `IMAGEURL`	   value = r_url ).

.IMAGEURL is the attribute binded to IMAGE UI element.

Former Member
0 Kudos

Hi Saurabh,

Thanks for your reply. I have already seen your this reply in an earlier thread. It will call the Image URL but I want to display this image into a large WD application and at the top of the WD page this image should be displayed.

Is there any way to display this image as normal image. Please suggest.

Former Member
0 Kudos

Hello SANKET,

You can upload/create MIME object/image in ur WD component, and then in UI image attribte assign this image.

Thanks,

Swanand.

Former Member
0 Kudos

hi,

right click ur application and then click on create mime object.

with Mime Objects u cn upload doc , jpeg, or giff files from our local system into the webdypnpro system .

You can even try creating the MIME objects in webdynrpo abap .

Right click on ur component->mime object->import

after importing you can see that image into your component as MIME object .Now insert a UI element image into your view layout .

Go to the source property of IMAGE element and select F4 option , u will find a window is opening with some tabs

Select tab COMPONENT IMAGES and component name select your component .

You will find the image which you have imported into this section just select the image and save it.

In the transaction sicf/bc/webdynpro , u cn check your component name there you can view the mime objects created by you .

also refer the SAP online help :

http://help.sap.com/saphelp_crm50/helpdata/en/46/bb182fab4811d4968100a0c94260a5/content.htm

to knw more abt mime repositories.

http://help.sap.com/saphelp_nw04/helpdata/en/f3/1a61a9dc7f2e4199458e964e76b4ba/content.htm

regards,

Amit

Former Member
0 Kudos

Hi Amit,

I have already a Mime image in my database. I can access it by SE80(Mime Object). But when I am using this Mime object into my WD compoent in a Image UI element. It picks up the XSTRING value but not able to display the image, when application executed.

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 have checked CL_WD_IMAGE method set_height, but not able to implement it in the Saurabh code.

If anyone have any idea, how to display a image in a wd application from the Mime object, which is already created in SAP.

Please suggest.

Former Member
0 Kudos

Hi Saurav

I've used your code and it's working for me. Wish I could give you some points. Anyway thanks a lot.

Pushpraj

Former Member
0 Kudos

Hi Pushpraj,

Can you please share the solution with us.

Former Member
0 Kudos

Hi Sanket

As I said I used Saurav's code for putting the image in a temporary URL.

Be sure that IMAGEURL is the attribute bound to the source property of the image UI element.

Also lv_img should be the xstring value obtained through get_attribute() on the attribute which is bound to the data property of the image UI element.

Hope it helps.

Pushpraj

Former Member
0 Kudos

Ok you have used the Saurabh code. Actually my requirement was something different, I wanted to show an Mime Image(Already in DB) at the starting of the page, but saurabh code will open the image in a external window that was not my requiremnt.

Anyways Thanks for reminerring me this point once again.

Former Member
0 Kudos

Hi

Saurabh's code doesnot open a new window.

I too have had a problem with xstring values being displayed as a cross mark.

But I don't see how the xstring value comes into picture in your case. You just need to choose the image from the component images tab (on F4) in the source property of the image UI element.

Pushpraj

Former Member
0 Kudos

Hi,

Have you read the full thread?

My requirement is as above:

I have already a Mime image in my database. I can access it by SE80(Mime Object). But when I am using this Mime object into my WD compoent in a Image UI element. It picks up the XSTRING value but not able to display the image, when application executed.

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 am also not using the component images, I want to use an existing mime image.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>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.