cancel
Showing results for 
Search instead for 
Did you mean: 

Image not displayed properly

Former Member
0 Kudos

Hi,

I am trying to diplay image on my screen. Image I have uploaded in MIME but when displayed on screen , it's displayed as CROSS ( X )

I am writing below code to dispaly the image.

DATA: lc_MIME TYPE REF TO if_mr_api,

lv_image TYPE xstring,

lv_url TYPE string VALUE 'SAP/PUBLIC/BC/icons/ogo.bmp'.

lc_MIME = cl_mime_repository_api=>get_api( ).

lc_MIME->get( EXPORTING i_url = lv_url

IMPORTING e_content = lv_image ).

lo_el_context->set_attribute(

name = `LOGO`

value = lv_image).

Can any one help what can be the reason?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I am seeing it now that you set the content .. it is not at all needed.

You can just select the source property of Image (at the rightmost) you can select a small icon which leads you to the selection screen to standard icon screen.

Or as you already did.

lo_el_context->set_attribute(
           name =  `LOGO`
            value = lv_url  ).

You do not need to get the content,it is needed for Office files.

Answers (4)

Answers (4)

Former Member
0 Kudos

bmp is not a good image format for web applications. Go with .gif .jpg or .png.

Start URL with /

There are similar folders in mime-repository. The correct URL might as well be this one:

/sap/public/bsp/sap/public/bc/icons/logo.bmp

Just try by calling it directly in web browser to see whether it is correct.

http://<server>:<port>/sap/public/bsp/sap/public/bc/icons/logo.bmp

Alternative way of adding images to Web Dynpro Applications

It's easy to get lost in mime repository ;-).

For web dynpro I would like to recommend another way of dealing with images or mimes in general.

Create a Web Dynpro component, e.g. ZIMAGES and add the mimes to this component.

The images can be accessed by setting the property imageSource of ui element image to value:

 
{ZIMAGES}/logo.gif

Have fun, Silke

PS:

http://help.sap.com/saphelp_nw70ehp1/helpdata/de/ec/bb08428dab5f24e10000000a1550b0/frameset.htm

Former Member
0 Kudos

Thanks every one for your time and reply, I have use some other way to call image but you guys seems to be correct my path may be wrong. Thanks Silke also for letting me know the other approch.

gill367
Active Contributor
0 Kudos

also

'SAP/PUBLIC/BC/icons/ogo.bmp'.

path should be '/SAP/PUBLIC/BC/icons/ogo.bmp'.

Former Member
0 Kudos

>

> also

>

>

'SAP/PUBLIC/BC/icons/ogo.bmp'.

>

> path should be '/SAP/PUBLIC/BC/icons/ogo.bmp'.

Thanks mate.

Correct the URL as /SAP/PUBLIC/BC/icons/ogo.bmp

Former Member
0 Kudos

>

> lv_url TYPE string VALUE 'SAP/PUBLIC/BC/icons/ogo.bmp'.

>

is this name correct ogo.bmp ?.

Have you tried any other .gif files of jpg files ?

gill367
Active Contributor
0 Kudos

In the source property of the IMAGE UI element just give the name of the image that you have uploaded in the MIME repository.

like in this case just give ogo.bmp in the image source.

if you have bound the property to the context attribute logo.

then just pass the ogo.bmp to it

lo_el_context->set_attribute(
name = `LOGO`
value = 'ogo.bmp').

thanks

sarbjeet singh