2009 Oct 28 1:04 PM
Dear experts,
I have written a program that generates an excel file and the displays this excel in a screen.
--> requirement was not to open MS Excel as an application, but to display the excel file in the SAP screen
--> excel is NOT an ALV report
I used the HTML Viewer to display the excel in my screen (CL_GUI_HTML_VIEWER).
Everything works fine, only in the excel file displayed in the HTML viewer, the excel toolbar (is not displayed).
Can anybody help me in how to display the excel file with excel toolbar (as the user needs to make modifications, and then needs to save the file)...
Thank you for your valuable inputs.
Rgds,
Michiel Strybol
2009 Oct 28 2:06 PM
Hello Michael!
Could u share your code, please? What technique do u use to open it?
I suggest u technique i would apply.
1) On your screen place a custom container control (I've used CC_EXCEL)
2) Put this code into your program
report zjdtest.
DATA: go_control type ref to I_OI_CONTAINER_CONTROL,
go_container type ref to cl_gui_custom_container,
go_document_proxy type ref to i_oi_document_proxy.
data: gt_file type FILETABLE,
gd_rc type i.
parameters p_file type localfile.
at selection-screen on value-request for p_file.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Open file'
file_filter = cl_gui_frontend_services=>filetype_excel
CHANGING
file_table = gt_file
rc = gd_rc.
check gd_rc ne -1.
read table gt_file into p_file index 1.
start-of-selection.
call screen 0100.
module STATUS_0100 output.
SET PF-STATUS 'TEST'.
endmodule.
module HANDLE_EXIT input.
leave program.
endmodule.
module OPEN_EXCEL output.
data: ld_document_url type localfile.
check go_control is initial.
CALL METHOD c_oi_container_control_creator=>get_container_control
IMPORTING control = go_control.
CREATE OBJECT go_container EXPORTING container_name = 'CC_EXCEL'.
CALL METHOD go_control->init_control
EXPORTING r3_application_name = 'R/3 TR'
inplace_enabled = 'X'
parent = go_container.
CALL METHOD go_control->get_document_proxy
EXPORTING document_type = 'Excel.Sheet'
IMPORTING document_proxy = go_document_proxy.
concatenate 'file://' p_file into ld_document_url.
CALL METHOD go_document_proxy->open_document
EXPORTING document_url = ld_document_url
open_inplace = 'X'
open_readonly = 'X'.
endmodule.
2009 Oct 28 2:06 PM
Hello Michael!
Could u share your code, please? What technique do u use to open it?
I suggest u technique i would apply.
1) On your screen place a custom container control (I've used CC_EXCEL)
2) Put this code into your program
report zjdtest.
DATA: go_control type ref to I_OI_CONTAINER_CONTROL,
go_container type ref to cl_gui_custom_container,
go_document_proxy type ref to i_oi_document_proxy.
data: gt_file type FILETABLE,
gd_rc type i.
parameters p_file type localfile.
at selection-screen on value-request for p_file.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Open file'
file_filter = cl_gui_frontend_services=>filetype_excel
CHANGING
file_table = gt_file
rc = gd_rc.
check gd_rc ne -1.
read table gt_file into p_file index 1.
start-of-selection.
call screen 0100.
module STATUS_0100 output.
SET PF-STATUS 'TEST'.
endmodule.
module HANDLE_EXIT input.
leave program.
endmodule.
module OPEN_EXCEL output.
data: ld_document_url type localfile.
check go_control is initial.
CALL METHOD c_oi_container_control_creator=>get_container_control
IMPORTING control = go_control.
CREATE OBJECT go_container EXPORTING container_name = 'CC_EXCEL'.
CALL METHOD go_control->init_control
EXPORTING r3_application_name = 'R/3 TR'
inplace_enabled = 'X'
parent = go_container.
CALL METHOD go_control->get_document_proxy
EXPORTING document_type = 'Excel.Sheet'
IMPORTING document_proxy = go_document_proxy.
concatenate 'file://' p_file into ld_document_url.
CALL METHOD go_document_proxy->open_document
EXPORTING document_url = ld_document_url
open_inplace = 'X'
open_readonly = 'X'.
endmodule.
2009 Oct 28 2:07 PM
I mean make a test program with this code to understand how it works))
2016 Apr 07 8:39 AM
2009 Oct 28 2:20 PM