Show TOC

Using OfficeControl Locate this document in the navigation structure

 

This simple example describes how you can use OfficeControl to integrate a Microsoft Office document into a Web Dynpro application.

Note Note

It is a pure display scenario (OfficeControl.expertMode=false), which is especially suitable for prototyping. Keep in mind that this type of scenario can cause performance bottlenecks. You can find more complex examples in the system in package SIOS.

End of the note.

OfficeControl is implemented in a Web Dynpro application that is used by a defined user community, since the installation of the respective Office program must be installed on the client.

Note Note

If there are any problems displaying OfficeControl make sure that the Active Component Framework (ACF) is correctly installed. See also SAP Note 846952.

End of the note.
Prerequisites
  • Web Dynpro Component, Window, and View for your application

  • In this example a file is read that is called test.doc, and is kept in the MIME repository.

Define Context
  1. Go to the context of your view and define a context node with a context element of type XSTRING, which is to be used for saving the content.

  2. Define a further context element for the visibility, for example, VISIBLE of type WDUI_VISIBILITY.

  3. To store your Office file in the context, use the WDDOMODIFYVIEW method.

    Syntax Syntax

    1. METHOD wddomodifyview.
      
        DATA:
          mime_repository TYPE REF TO if_mr_api,
          content TYPE xstring,
          url TYPE string VALUE
      '/SAP/BC/WebDynpro/SAP/PUblic/BC/ssr/uuielibs/office_integration' &
      '/test.doc'.
      
      * just do it once
        CHECK first_time = abap_true.
      
        mime_repository ?= cl_mime_repository_api=>get_api( ).
      
        CALL METHOD mime_repository->get
          EXPORTING
            i_url     = url
          IMPORTING
            e_content = content.
      
        wd_context->set_attribute( name = 'DATAS' value = content ).
      
        wd_context->set_attribute( name = 'visible'  value =
      cl_wd_office_control=>e_visible-visible ).
      ...
      endmethod.
    End of the source code.
  4. Save your entries.

Integrate OfficeControl into the Layout
  1. Add a OfficeControl UI element to your view.

  2. Bind property OfficeControl.dataSource to the context attribute for the content.

  3. Bind property OfficeControl.visible to the context node for the visibility.

  4. Save your entries.