Product Information
How to enable the SAP Desktop Office Integration for SAP GUI for HTML and SAP GUI for Java
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 as20/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.
- For example, if Microsoft Office was configured for the locale
- 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:
- If you develop a new application, it is better to use the SAP XCO XLSX library. It offers a modern API for reading and writing XLSX files. The drop-in replacement is using XCO itself.
- Most table or list controls in SAP GUI, such as ALV or ABAP List, support export to Excel natively. Beginning with SAP_BASIS 7.57, they also support export to Google Sheets:
- If your users are only using Windows, the SAP Business Client might also be a solution, as it brings together applications like Fiori Launchpad (FLP) and SAP GUI. Also it allows to start from a web application and navigate to a SAP GUI for Windows application which supports the Desktop Office Integration:
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).
Interesting.
Will the new SAP Desktop Office Integration control (cl_sovy_container_control) be supported also in background/non-dialog mode?
Hi Shai,
thanks for your intereset. And yes, the drop-in replacement will also run in background/non-dialog mode. It is working on the file and doesn't require any UI controls for the import scenario. In case of the export scenario it depends on which method you would invoke. A method like
will invoke the method
which will only work in dialog mode. To stay fully in the background you would have to instead invoke the method
to get the xstring representation of the created spreadsheet.
But yes, the background mode would be supported. However if you would like to develop new functionality I would propose to use the SAP XCO XLSX library instead. The XCO library also supports background/non-dialog mode.
https://help.sap.com/docs/btp/sap-business-technology-platform/xlsx
Best regards,
Christian
Thanks for the detailed info.
Does the XCO library handles also file download/upload and/or Google workspace integration
(And not just manipulation of the XSLX files themselves)?
Hi Shai,
the XCO library works directly on binary representations of a file (XSTRING). The SOVY container is using the following methods to upload and download files:
Those methods are also supported in SAP GUI for HTML and SAP GUI for Java and will therefor also work in other environments.
The Google workspace integration API is currently not released for direct customer usage.
We won't prohibit anybody from using the SOVY container for new development, but we think the cleaner and more future proof method is to use the XCO library for new code.
Best regards,
Christian
OK.
Thanks again.
So if I understood correctly, the SOVY container is only a workaround/solution for replacement of c_oi_container_control_creator.
It doesn't support background/non-dialog mode and it isn't an official API for Google Workspace Integration.
Hi Shai,
the SOVY container is a solution for applications which are currently using the c_oi_container_control_creator and want to also support SAP GUI for Java/HTML. And it does support background/non-dialog mode.
It is using the Google Workspace Integration API, but the SOVY container is not the official API. The official Google Workspace Integration API is not yet released.
Best regards,
Christian
Hi Christian,
So just to clarify, for on-premise S/4HANA customers, they won't really be able to go-live with this till FPS01 comes out for S/4HANA 2023 in about March 2024? (FPS00 is not a long term supported release but you could obviously play with this feature in November at least).
Just hoping you meant to say S/4HANA 2022 FPS01 release as that's the one my current customer is targeting.
Cheers,
Matt
Hi Matt,
unfortunately it currently is S/4HANA 2023. If you want to talk about any specific issues I'm also available for a private chat.
Best regards,
Christian
Thanks, nice!
What needs to be installed on the client? Will Microsoft Excel on MacOS be supported?
Hi Stephan,
nothing needs to be installed on the client. It works completely on the ABAP server. I've developed this functionality on a Mac and it works perfect. And on top of that we now do also support customers who have switched from Microsoft Office to Google Workspace and no longer have any office applications installed on their machines.
Best regards,
Christian
Hi Stephan,
We are on S/4 HANA release SAP_BASIS 756 0002 SAPK-75602INSAPBASIS, and we don't have SOVY container code in our system. Do you know SAP Note ID, where this correction is included??
BR,
Fidija
Hi Fidija,
sorry for the late answer. The SOVY package is not yet down-ported. Which scenario would be interesting for you? The import or the export use-case? I also think that SAP_BASIS 756 is too far away from current dev systems.
Best regards,
Christian
Dear Christian,
Thank you for these promissing news. I have two questions:
1. Will this be available for customers with S/4 HANA on premise 2021 edition (in form of OSS note or sth.)?
2. Do you plan to develop solutions for other Office applications like MS Outlook? We have been using DOI (via win-gui) with outlook in scenario where an open (not yet saved) email can be imported and attached to a SAP document (our own GOS service) and we really miss this functionallity in web-gui environment.
Best regards,
Artur
Hi Artur,
we're currently discussing possible downport options. But the downport will probably be limited to the import only use-case. Which use-case would be interesting for you?
We currently don't have Outlook or Google Mail on our agenda at all. We're also discussing about supporting some Word scenarios, but not this is first time I've heard about Outlook scenarios. I can bring report this requirement, but currently I don't see a lot of capacity for this topic. But I'll keep it in mind.
Best regards,
Christian
Hello Christian,
The two scenarios of most of our interest would be import/export Excel files with multiple sheets and of course previosuly described Outlook scenario.
Best regards,
Artur
Hi Christian, we have a use case primarily for import scenario (use of t-code CNMASSCREATE). We are on SAP_BASIS 757 (SP 0002). Is there any possibility of implementing this scenario without waiting for S/4HANA 2023 release next year?
Hi Sagar,
we're working on it. But I can't promise a specific release. Thank you for your feedback.
Best regards,
Christian
Hi Christian,
We have custom WebDynpro program where office control is used to display word file inside the window. This office file is working fine in Microsoft Edge browser but not in Chrome browser. The application can open a word file, allow user to update the file and save it. This functionality is not working in Chrome browser. There is a 3rd party addon available, but it is very costly and hence not acceptable to customer.
So please suggest us any solution for this where we should use both Edge and Chrome browser for open/update and save the document.
Regards,
Surya
Hi Surya,
we're currently working on a solution for exactly this issue. Would you be available for a short call to understand your scenario and to give you a demo of our solution?
Best regards,
Christian
Hi Christian,
Sure,
Lets share your email id to share the zoom link to discuss the possibility to understand the scenario.
Regards,
Surya
suryakanta.senapati@gmail.com
Ok. Mail is out. Looking forward to meeting with you.