..4 OpenOffice compatibility

For develop form the MS Excel 2007 (or higher) must be installed on the developer's local computer.

But for opening a runtime-result file on the user's local machine, you can use another application instead MS Office. It can be OpenOffice, for example.

NOTE:

The built-in viewer of the FM 'ZXLWB_CALLFORM' is compatible only with MS Office. Therefore you have to use the FM 'ZXLWB_CALLFORM' only for retrieving a runtime-result file and saving it to user's local machine. After that you can open it by any available application, using method CL_GUI_FRONTEND_SERVICES=>EXECUTE, for example.

Example of printing program:

REPORT z_shipping_label.


* declare a context

DATA gs_context TYPE zcontext_shipping_label .


* fill the context

gs_context-to_name = 'Dan Tedford' .

gs_context-to_street = '811 Alworth Avenue' .

gs_context-to_town = 'Middlefield' .

gs_context-to_state = 'CA' .

gs_context-to_zip = '98567' .


* save file to desktop

CALL FUNCTION 'ZXLWB_CALLFORM'

EXPORTING

iv_formname = 'SHIPPING_LABEL'

iv_context_ref = gs_context

iv_viewer_suppress = 'X'

iv_save_as = 'C:\Users\Igor\Desktop\QQQ.XLSX'

EXCEPTIONS

OTHERS = 2.

IF sy-subrc NE 0 .

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 .

ENDIF .


*open file in OpenOffice

cl_gui_frontend_services=>execute(

EXPORTING

synchronous = 'X'

application = 'SOFFICE.EXE'

parameter = 'C:\Users\Igor\Desktop\QQQ.XLSX'

operation = 'OPEN'

maximized = 'X'

EXCEPTIONS

OTHERS = 10 ).