Skip to Content

open documents with cl_htmlviewer

Feb 08, 2017 at 08:45 PM


avatar image


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
        type                 = lv_mimetype
*        size                 = i_size
        assigned_url         = gf_url
        data_table           = gt_content
        dp_invalid_parameter = 1
        dp_error_general     = 2
        cntl_error           = 3
        OTHERS               = 4.
    CALL METHOD cl_htmlviewer->show_url   "data
        url                    = gf_url
        in_place               = ' '
        cntl_error             = 1
        cnht_error_not_allowed = 2
        cnht_error_parameter   = 3
        dp_error_general       = 4
        OTHERS                 = 5.
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Sandra Rossi Feb 09, 2017 at 08:14 PM

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 ...)

10 |10000 characters needed characters left characters exceeded