Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

open documents with cl_htmlviewer

Former Member
0 Likes
1,211

hi,

i am using load_data and show_url of class cl_htmlviewer for displaying different files in new browser window. the variable lv_mimetype is set depending on the mime-type, e.g. application/pdf for pdf document or application/msword for word document.

with the coding below it is working perfect for PDF !!! the pdf is opened directly in new browser window. for all other formats like word-documents, excel, etc.... i come to the "download popup" of internet explorer. i can download the file. when i open it i get another popup which asks me with which application i want to open the file, because the type is now known.

so why is this not working for other formats than PDF ? why i get this popups for other documents ? i want to open the other forms just like pdf without this popups.

any ideas ?

br Martin

CALL METHOD cl_htmlviewer->load_data
      EXPORTING
        type                 = lv_mimetype
*        size                 = i_size
      IMPORTING
        assigned_url         = gf_url
      CHANGING
        data_table           = gt_content
      EXCEPTIONS
        dp_invalid_parameter = 1
        dp_error_general     = 2
        cntl_error           = 3
        OTHERS               = 4.
 
    CALL METHOD cl_htmlviewer->show_url   "data
      EXPORTING
        url                    = gf_url
        in_place               = ' '
      EXCEPTIONS
        cntl_error             = 1
        cnht_error_not_allowed = 2
        cnht_error_parameter   = 3
        dp_error_general       = 4
        OTHERS                 = 5.
1 REPLY 1
Read only

Sandra_Rossi
Active Contributor
0 Likes
678

cl_htmlviewer is a little bit misleading. The class you are using is probably CL_GUI_HTML_VIEWER, and cl_htmlviewer is the variable name of the instance.

You can never open directly a Word file in a web browser. Only PDF and image files can be directly displayed.

If you only want to start MS Word to see the document, I think you may use the Desktop Office Integration framework. The simplest way would be to use the document viewer (C_OI_CONTAINER_CONTROL_CREATOR=>GET_DOCUMENT_VIEWER ...)