cancel
Showing results for 
Search instead for 
Did you mean: 

image uploading on application server

Former Member
0 Kudos

i want to upload image on application server and  display it .right now i am able to store image in aaplication server but it is in binary format how to make it display ?

i am using following methd to store image on application server.

DATA lv_filename      TYPE string.

OPEN DATASET lv_filename FOR OUTPUT IN BINARY MODE.
      LOOP AT lt_solix_tab INTO ls_solix.
        TRANSFER ls_solix TO lv_filename.
      ENDLOOP.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Sumeety,

   Get the x string content from the applicaton server & using any action display it.

Code like below.

   DATA content TYPE xstring.

   DATA mimetype TYPE string.

   DATA ev_mime_type TYPE MIMETYPES-TYPE.

   DATA filename TYPE string.

   OPEN DATASET lv_filename FOR INPUT IN BINARY MODE.
      READ DATASET lv_filename INTO content.
   CLOSE DATASET lv_filename.

      " get mime type for file type
      DATA lv_file_name TYPE c.
      lv_file_name = lv_filename.

      CALL FUNCTION 'SDOK_MIMETYPE_GET'
        EXPORTING
          extension                  = lv_file_name
        IMPORTING
          MIMETYPE                   = ev_mime_type.

      mimetype = ev_mime_type.

    CALL METHOD cl_wd_runtime_services=>attach_file_to_response
        EXPORTING
            i_filename      = filename
            i_content       = content
            i_mime_type     = mimetype
*          i_in_new_window = ABAP_FALSE
*          i_inplace       = ABAP_FALSE
    .

But this will open the image separately from you application  & u can download it in your desktop.

If you want to use it in your application & display it inside your view then upload the image as MIME object in your web dynpro component.

Reply in case of any issue.

Regards,

Monishankar Chatterjee