Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
christian_grail
Advisor
Advisor

The drop-in replacement has been developed to enable the SAP Desktop Office Integration (DOI) to run on more platforms and operating systems. The SAP Desktop Office Integration is a solution for application developers to integrate Office products like Microsoft Excel and Microsoft Word in their SAP GUI applications. This technology was developed in the 90s and is still heavily used by a lot of applications and customers. It is for example widely used to import and export data from and into an SAP system.


Until now the SAP Desktop Office Integration worked only on Microsoft Windows in combination with SAP GUI for Windows, because it relies on the OLE2 application interface which is only available to native applications like SAP GUI for Windows. With the shift to web applications and other operating systems like Apple macOS this has become an issue for customers who are using SAP GUI applications with SAP GUI for Java or SAP GUI for HTML.


If a customer tries to execute a program which is using the SAP Desktop Office Integration in SAP GUI for HTML or SAP GUI for Java, the program will terminate with the following exception:



Category:       ABAP programming error	
Runtime Errors: RAISE_EXCEPTION
Short Text: Exception condition "JAVABEANNOTSUPPORTED" raised.

What Is the Drop-In Replacement of the SAP Desktop Office Integration?


A drop-in replacement is a component which can replace another component without any other code or configuration changes. The drop-in replacement for the SAP Desktop Office Integration keeps on using the same interfaces as the current solution, but enables applications to also run in the web browser in SAP GUI for HTML or SAP GUI for Java. The goal is to keep the migration effort as low as possible and in most cases it's a one-line code-change. The first version of the drop-in replacement for the SAP Desktop Office Integration will support the import and export scenario of data using Microsoft Excel.


Overview of the Drop-In Replacement of the SAP Desktop Office Integration



Code Example of the Current SAP Desktop Office Integration


With the original implementation you have to get the container control from the class C_OI_CONTAINER_CONTROL_CREATOR and call the method get_container_control( ) which returns the container control object implementing the interface I_OI_CONTAINER_CONTROL. Using the container control object you've been able to get an instance of the document proxy through the method get_document_proxy( ) and on the document proxy instance you've been able to get an instance of the spreadsheet interface by calling the method get_spreadsheet_interface( ).

The code needed to set data in a sheet would look like the following:
c_oi_container_control_creator=>get_container_control( 
IMPORTING control = DATA(container_control) ).
...
container_control->get_document_proxy(
EXPORTING document_type = 'Excel.Sheet'
IMPORTING document_proxy = DATA(document_proxy) ).
...
document_proxy->get_spreadsheet_interface(
IMPORTING sheet_interface = DATA(spreadsheet) ).
...
spreadsheet->set_ranges_data( ... ).

Required Code Change


To switch to the drop-in replacement for SAP Desktop Office Integration, you just have to change the initial call to obtain the container control. Instead of obtaining the container control from the class C_OI_CONTAINER_CONTROL_CREATOR, the container control will then be retrieved from the class CL_SOVY_CONTAINER_CONTROL. The subsequent calls or application logic do not need to be changed.


To enable the in-memory office integration to work properly, an integration mode needs to be provided. This is necessary, because the drop-in replacement needs to now know how it is intended to be used. Previously this was not needed because the Office application was opened at the beginning of the process. Because this is no longer possible in a web application or with SAP GUI for Java, we needed to introduce an integration mode. Of all the possible use cases, we currently support the following integration modes:




  • soi_mode_export

    • For use cases where data is being exported from an SAP system to a Microsoft Excel file.



  • soi_mode_import

    • For use cases where data is being imported into an SAP system from a Microsoft Excel file.




Required Code Change for the Export Use-Case


You need to get rid of the following line of code:
c_oi_container_control_creator=>get_container_control( ... ).

and replace it with the following line:
cl_sovy_container_control=>get_container_control(
EXPORTING office_integration_mode = cl_sovy_container_control=>soi_mode_export
IMPORTING control = DATA(container_control) ).

For the export use case, it is now mandatory to call one of the following methods to finalize the data export:

  • save_as( )

  • save_document_to_url( )

  • close_document( )

  • save_copy_as( )


This is a signal for the drop-in replacement that the file creation has been finished and can now be saved.


An example of the export use-case can be found in the package SOVY_IMP. The report TEST_SOVY_SHEET_EXPORT demonstrates how you can export data from an SAP system into an Excel Sheet.



Required Code Change for the Import Use-Case


You need to get rid of the following line of code:
c_oi_container_control_creator=>get_container_control( ... ).

and replace it with the following line:
cl_sovy_container_control=>get_container_control(
EXPORTING office_integration_mode = cl_sovy_container_control=>soi_mode_import
IMPORTING control = DATA(container_control) ).

All subsequent calls do not need to be modified. By default, the SAP GUI Desktop Office Integration will be used in SAP GUI for Windows. Therefore you don't risk anything but gain support for all other use-cases.


An example of the import use-case can be found in the package SOVY_IMP. The report TEST_SOVY_SHEET_IMPORT demonstrates how you can import data from an Excel sheet into an SAP System.



Configuration Options


The method cl_sovy_container_control=>get_container_control( ) can be configured by passing the optional parameter structure config. The following configuration options are possible:

  • enforce_new_integration: By default the in-memory office integration will fall back to the old SAP GUI for Windows based office integration, if the call is executed within a SAP GUI for Windows session. If you want to always enforce the use of the in-memory office integration, you can override this by setting the value to:

    • enforce_new_integration = ABAP_TRUE



  • disable_unimplemented_errors: By default the in-memory office integration will throw exceptions, if unimplemented methods are being invoked. The reason is that the in-memory office integration doesn't implement the full feature set of the API. You can prevent the raising of errors by setting the value to:

    • disable_unimplemented_errors = ABAP_TRUE



  • enable_cloud_integration: Starting with SAP S/4 HANA 2022, customers are able to export sheets natively to Google Sheets. By enabling the cloud integration, the standard file chooser will be replaced by the cloud file picker. This does not only allow to store an Excel file locally, but also allows to store a sheet in the cloud. You can enable the cloud integration by setting the value to:

    • enable_cloud_integration = ABAP_TRUE




Google Workspace Integration: Google Sheets Export


Google and SAP partnered to allow customers to connect core SAP software designed for running all mission-critical processes in the cloud with the collaborative capabilities of Google Docs and Google Sheets. This innovates how work gets done across the enterprise. As part of this partnership the SAP Desktop Office Integration drop-in replacement also supports exporting sheets directly from SAP to Google Sheets. To learn more about what has been achieved as part of this partnership, please read the following blog post:

https://blogs.sap.com/2022/08/21/saps-ui-technologies-enabling-google-workspace/

Limitations


While the drop-in replacement for the SAP Desktop Office Integration will be able to support a majority of all the relevant use-cases it has the following limitations:

  • Microsoft Excel won't be opened during the data is read or written.

    • After the write operations are finished, the Excel file will be downloaded and can be opened

    • For the read operation during the import of a sheet it is no longer necessary to have Excel open as the file is read by the backend



  • With the current Desktop Office Integration, the formatted data is returned in the locale which was configured for the operating system.

    • For example, if Microsoft Office was configured for the locale us_EN, then the date was returned as 20/02/2023. In case of the in-memory office integration, the locale can be passed to the Office integration or the locale of the logged-on SAP user is being used.



  • The result of a formula will not be re-evaluated when a cell is read. Microsoft Excel stores the result of a formula as part of the cell value. During a read operation, the formula will not be re-evaluated. For most scenarios, this should be the desired behavior. However if the formula is dependent for example on the current date the result might be different. In such a case, the sheet needs to be opened and saved again before importing the sheet into SAP.

  • Not all methods from the SAP GUI for Windows Desktop Office Integration are implemented. The old office integration offered methods to modify menu items in Excel, change the format and styles, set selections and hide or show rows. Some of these functions do not make sense, if the application is not open while the office integration is running; other functionalities are not supported by the underlying frameworks and libraries.

  • Currently only the export and import use cases are supported.

    • Scenarios like updating an existing Excel sheet are not yet supported.

    • Scenarios like download and re-upload of Excel files require the implementation/adaption of the application to first do an export and then an independent import.

    • Interactive scenarios where Excel and the SAP application are open side-by-side are not supported.




Alternatives


The drop-in replacement for SAP Desktop Office Integration might not always be the right solution. Here are some alternatives:

Call for Action


Because a lot of customers have implemented the SAP Desktop Office Integration in custom programs and reports we are not aware of a lot of scenarios. Initially we've built support for the pure import and export use cases for which we have received a lot of bug reports. If your scenarios are not covered by the current implementation we would be interested to hear about them to be able to improve our solution. Please use the comment section to tell us about your requirements or get in touch to us by mail.

Availability


The drop-in replacement for the SAP Desktop Office Integration will be available with SAP S/4HANA Cloud, public edition 2302 (SAP_BASIS release 7.93 or newer), SAP S/4HANA Cloud, private edition 2023 and SAP S/4HANA 2023 (SAP_BASIS release 7.58 or newer).

We're also providing a downport of the import functionality via a correction instruction for older releases like SAP S/4HANA 2020 or newer for the SAP_BASIS releases 7.55, 7.56 and 7.57.

More information regarding the downport of the import functionality can be found in SAP Note 3386113

This downport of the import functionality will also be delivered with the following service packs:

  • SAP_BASIS 7.55 SP08

  • SAP_BASIS 7.56 SP06

  • SAP_BASIS 7.57 SP04

32 Comments