cancel
Showing results for 
Search instead for 
Did you mean: 

I_OI_DOCUMENT_PROXY

Former Member
0 Kudos

Using I_OI_DOCUMENT_PROXY I can display on GUI screen different pictures and objects.

However I can't figure out how to display PDF document!!!!!!

Interface I_OI_DOCUMENT_PROXY provides method OPEN_ACTIVEX_DOCUMENT.

But there is no documentation (few lines in BCCIOFFI.PDF are not sufficient, if you need to create working application).

And there are no functioning samples (SAPRDEMO_ACTIVEX_INTEGRATION generates only error messages)

BACR

Accepted Solutions (0)

Answers (2)

Answers (2)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

There is a also a GUI class specific to PDFs that is available in 46C and higher.  It is CL_GUI_PDF_VIEWER in our 46C system and CL_GUI_PDFVIEWER in our 620 system. It has a lot of nice methods to control the PDF view from within ABAP. If you want a real simple solution and your PDFs are accessible from the Frontend PC you might try just calling cl_gui_frontend_services=>execute. All you have to do is pass it a path (local drives, network mapped drives, or UNC) to the PDF file you want to open through the application parameter. This will then open the PDF in whatever PDF view is installed on the user's PC.

The following is a piece of code that uses several of the methods that have been discussed.  In this example I am actaully opening the PDF in a attached web viewer.

case directory+len(4).

          when '.PDF' or '.pdf' or '.HTM' or '.htm' or

               '.JPG' or '.jpg' or '.GIF' or '.gif' or

               '.BMP' or '.bmp' or '.ITS' or '.its' or

               '.HTT' or '.htt' or '.TIF' or '.tif'.

            perform web_browser_file_processing using directory.

          when '.DOC' or '.doc' or '.RTF' or '.rtf' or

               '.WRI' or '.wri' or '.XLV' or '.XLS' or

               '.DOT' or '.dot' or '.PPT' or '.ppt' or

               '.VSD' or '.vsd'.

            perform desktop_interface using directory.

          when others.

****Execute/Display the file using the frontend's file

****association

            call method cl_gui_frontend_services=>execute

               exporting

*                DOCUMENT =

                 application = directory

*                PARAMETER =

*                DEFAULT_DIRECTORY =

*                MAXIMIZED =

*                MINIMIZED =

*                SYNCHRONOUS =

              exceptions

                cntl_error = 1

                error_no_gui = 2

                bad_parameter = 3

                file_not_found = 4

                path_not_found = 5

                file_extension_unknown = 6

                error_execute_failed = 7

                others = 8.

            if sy-subrc <> 0.

              message i040 with directory.

            endif.

        endcase.

*&----


*

*&      Form web_browser_file_processing

*&----


*

*       Process the selected file in an inplace Web Browser

*----


*

*      -->DIRECTORY Full File name

*----


*

form web_browser_file_processing using    directory.

  data: url(255) type c.

  perform free_document_viewer.

****Create HTML Control

  if html is initial.

    create object html

      exporting

*      SHELLSTYLE =

        parent = splitter->bottom_right_container .

    if sy-subrc <> 0.

    endif.

  endif.

****Turn the filename into an URL

  concatenate 'file://'

              directory

              into url.

****Display document

  call method html->show_url

    exporting

      url = url .

  if sy-subrc <> 0.

  endif.

endform.                    " web_browser_file_processing

*&----


*

*&      Form desktop_interface

*&----


*

*       Display selected file in the inplace Desktop document viewer

*----


*

*      -->DIRECTORY Full file and path name of the selected file

*----


*

form desktop_interface using    directory.

  data: url(255) type c.

  perform free_html_viewer.

****Create the document viewer control

  if document_viewer is initial.

    call method c_oi_container_control_creator=>get_document_viewer

                  importing viewer = document_viewer.

    call method document_viewer->init_viewer

              exporting parent = splitter->bottom_right_container.

  endif.

****Turn the file/path into an URL

  concatenate 'file://'

             directory

             into url.

****Display document in place

  call method document_viewer->view_document_from_url

          exporting document_url = url

                    show_inplace = 'X'.

endform.                    " desktop_interface

athavanraja
Active Contributor
0 Kudos

Hi,

To display a pdf document within the SAP GUI (inplace) create HTML Viewer Control in the screen and load the control with the pdf document.

look at the HTML Viewer control sample program (SAPHTML_DEMO1) in transaction DWDM.

Just execute the above given program and type in the path for the PDF document in the input field and hit enter. You should see the pdf document in the HTML viewer (inplace).

Regards

Raja