This simple example describes how you can use OfficeControl to integrate a Microsoft Office document into a Web Dynpro application. You can find a description of the OfficeControl in the UI element referenve of this documentation.
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.
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.
If there are any problems displaying OfficeControl make sure that the Active Component Framework (ACF) is correctly installed. See also SAP Note 846952 .
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
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.
Define a further context element for the visibility, for example, VISIBLE of type WDUI_VISIBILITY.
To store your Office file in the context, use the WDDOMODIFYVIEW method.
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.
Save your entries.
Integrate OfficeControl into the Layout
Add a OfficeControl UI element to your view.
Bind property OfficeControl.dataSource to the context attribute for the content.
Bind property OfficeControl.visible to the context node for the visibility.
Save your entries.