cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to open document on browser

0 Kudos

Hello,

I am trying to open the documents which are saved with business object using the browser on there respective applications (excel, word, pdf etc). I have already done this in the BSP application and that is working fine. In WebDynpro application new window is not opening however I can see that respective catch data in SMICM. Please suggest possible resone for this problem.

Please find below code for the same.


* Assign the MIME Type.
  mimetype = ls_file_disp-mimetype.

  len = XSTRLEN( file_content ).
* Pass the control to Browser.

  CREATE OBJECT cached_response
    TYPE
      cl_http_response
    EXPORTING
      add_c_msg        = 1.

  try.
      call method cached_response->set_compression
        exporting
          options = cached_response->co_compress_based_on_mime_type
        exceptions
          others  = 1.
    catch cx_root.
  endtry.

  len = XSTRLEN( file_content ).
  cached_response->set_data( data = file_content
  length = len ).

  cached_response->set_header_field( name = if_http_header_fields=>content_type
  value = mimetype ).
  cached_response->set_status( code = 200 reason = 'OK' ).
  cached_response->server_cache_expire_rel( expires_rel = 180 ).

  CALL FUNCTION 'GUID_CREATE'
    IMPORTING
      ev_guid_32 = guid.
  read table lt_header_fields into ls_header_fields index 4.
  appl_url = ls_header_fields-value.

  concatenate 'Portal address' appl_url guid INTO display_url.


  cl_http_server=>server_cache_upload( url = display_url
                                  response = cached_response ).

Thanks,

Ashish

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Once you have generated the URL what is the method that you are using to open the URL in an external window?

You can use the following piece of code,

DATA lo_window_manager TYPE REF TO if_wd_window_manager.
  DATA lo_api_component  TYPE REF TO if_wd_component.
  DATA lo_window         TYPE REF TO if_wd_window.
 
  lo_api_component  = wd_comp_controller->wd_get_api( ).
  lo_window_manager = lo_api_component->get_window_manager( ).
 
  CALL METHOD lo_window_manager->create_external_window
    EXPORTING
      url    = lv_url " pass your URL 
    RECEIVING
      window = lo_window.
  lo_window->open( ).

Regards,

Radhika.

0 Kudos

Thanks Radhika.

Answers (0)