cancel
Showing results for 
Search instead for 
Did you mean: 

How to display image in IMAGE UI from mime repository ?

Former Member
0 Kudos

Hi

I am building web dynpro for the first time.

I try to display image in IMAGE UI but can't see image.

※image is displayed like

What is wrong with this source ?

Please help.

-

-


  • get image from mime repository

data:mime_repository type ref to if_mr_api,

content type xstring,

url type string value 'SAP/BC/WebDynpro/SAP/Z_HT_MIME/image.jpg'.

mime_repository = cl_mime_repository_api=>get_api( ).

call method mime_repository->get EXPORTING i_url = url

IMPORTING e_content = content.

  • set context

data:lo_element TYPE REF TO if_wd_context_element,

ls_context type REF TO wd_this->element_context.

lo_element = wd_context->get_element( ).

lo_element->set_attribute( name = 'URL' value = content ).

-

-


※If source is set image directly, Image is displayed.

  Type of Context 'URL' is String.

Thanks

Tom

Accepted Solutions (1)

Accepted Solutions (1)

gill367
Active Contributor
0 Kudos

In the source property of hte image uI just give

'image.jpg'

it will coem automatically.

thanks

sarbjeet singh

Former Member
0 Kudos

Thanks Baskaran, Sarbjeet

I got my used procedure is wrong.

I modified url to 'image.jpg' .Then the Image is displayed.

Please ask one more question.

If I will code absolute path name, what should I do ?

Tom

gill367
Active Contributor
0 Kudos

Sorry i am unable to get that.

what is your requirement. can you elaborate a bit.

also why you want to code the absolute path.

thanks

sarbjee singh

Former Member
0 Kudos

Sorry about my blind explanation.

I would like to build ALV containing image column which was displayed dynamically.

I ask above because I will think that images is used as shared data by not only this webdynpro but other webdynpros Aftertime,

In the first place if I have false design , tell me that.

Tom

Former Member
0 Kudos

Hi,

I think it is better to bind a context attribute of type string to the Source property.

You can fill the absolute URL or the image name directly to the context attribute. I would prefer to use the absolute URL which works anywhere in any component.

Hope this clears your doubt.

Former Member
0 Kudos

Thanks Baskaran.

My doubt was cleared !

But following code make image not displayed.

 data:url type string value 'SAP/BC/WebDynpro/SAP/Z_HT_MIME/image.jpg'

 lo_element = wd_context->get_element( ).+
 lo_element->set_attribute( name = 'URL' value = url ).

Setting url 'image.jpg' , Image is displayed.

What is wrong ? Is my declaration of path wrong ?

Former Member
0 Kudos

I solved .

Thanks a lot !

Tom

Former Member
0 Kudos

Hi

Good that you have solved it. Please post your solution as well for the readers of this forum.

Answers (1)

Answers (1)

Former Member
0 Kudos

For displaying image using image UI, it is enough to supply the URL for the source.

You do not need to get the content of type xstring. This procedure is used for getting the PDF or office files.

It is not applicable for image UI source property.