cancel
Showing results for 
Search instead for 
Did you mean: 

How to display image from custom table ?

former_member210804
Active Participant
0 Kudos
604

Hi,

I have stored the images of type rawstring in table zrao_img.

Now i want to display them in my webdynpro application.

Kindly provide me guidelines to follow.

Best regards,

Narasimha.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Narasimha,

You can use the below code for the same, I have used custom FM to get xstring of the image data from HR infotype.

________________________________________________________________________

DATA: guid TYPE guid_32,

         cached_response TYPE REF TO if_http_response,

         lv_xstring TYPE xstring.

   CALL FUNCTION 'Z_ESS_FM035'

     EXPORTING

       im_pernr   = im_pernr

     IMPORTING

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

_______________________________________________________________

-Manish

Answers (0)