2016 Feb 09 2:25 PM
hello Expert, i'm trying to open an excel inplace, edit the file save it.
i have create a screen and i'm able to open open the excel file using
in the pbo of the screen 100
c_oi_container_control_creator=>get_container_control
...
gc_control_excel->init_control
gc_control_excel->get_document_proxy
gc_doc_excel->open_document_from_table
i have also create and instance to handle the close_document event
SET HANDLER l_excel->on_close_document FOR gc_doc_excel..
and the file is opened correctly
the trouble is when i edit and save the excel document.
i close the document
IF NOT gc_doc_excel IS INITIAL.
CALL METHOD gc_doc_excel->is_destroyed
IMPORTING
ret_value = is_closed.
IF is_closed IS INITIAL.
CALL METHOD gc_doc_excel->close_document
EXPORTING
do_save = ' '
no_flush = ' '
IMPORTING
has_changed = v_changed
error = gt_errors.
IF gt_errors->has_failed = 'X'.
CALL METHOD gc_error->raise_message
EXPORTING
type = 'E'.
ENDIF.
ENDIF.
* Clear Document Resources
CALL METHOD gc_doc_excel->release_document
EXPORTING
no_flush = ''
IMPORTING
error = gt_errors.
IF gt_errors->has_failed = 'X'.
CALL METHOD gc_error->raise_message
EXPORTING
type = 'E'.
ENDIF.
the issue are:
1) the event on_close document is not triggered , although i have the variable has_changed = 1 and i have close and release the document.
2) if i try to recall the screen 100, the container is empty.
What do i miss here?
regards.
hello Expert, i'm trying to open an excel inplace, edit the file save it.
i have create a screen and i'm able to open open the excel file using
in the pbo of the screen 100
c_oi_container_control_creator=>get_container_control
...
gc_control_excel->init_control
gc_control_excel->get_document_proxy
gc_doc_excel->open_document_from_table
i have also create and instance to handle the close_document event
SET HANDLER l_excel->on_close_document FOR gc_doc_excel..
and the file is opened correctly
the trouble is when i edit and save the excel document.
i close the document
IF NOT gc_doc_excel IS INITIAL.
CALL METHOD gc_doc_excel->is_destroyed
IMPORTING
ret_value = is_closed.
IF is_closed IS INITIAL.
CALL METHOD gc_doc_excel->close_document
EXPORTING
do_save = ' '
no_flush = ' '
IMPORTING
has_changed = v_changed
error = gt_errors.
IF gt_errors->has_failed = 'X'.
CALL METHOD gc_error->raise_message
EXPORTING
type = 'E'.
ENDIF.
ENDIF.
* Clear Document Resources
CALL METHOD gc_doc_excel->release_document
EXPORTING
no_flush = ''
IMPORTING
error = gt_errors.
IF gt_errors->has_failed = 'X'.
CALL METHOD gc_error->raise_message
EXPORTING
type = 'E'.
ENDIF.
the issue are:
1) the event on_close document is not triggered , although i have the variable has_changed = 1 and i have close and release the document.
2) if i try to recall the screen 100, the container is empty.
What do i miss here?
regards.
2016 Feb 09 2:33 PM
Hi.
When you call
gc_control_excel->init_control
did you pass
REGISTER_ON_CLOSE_EVENT = C_X
REGISTER_ON_CUSTOM_EVENT = C_X
Hope to help
Bye
2016 Feb 09 7:46 PM
thanx for the reply but the register_on_close_event = c_x.
the event handler is implemented in this way
METHODS: on_close_document
FOR EVENT on_close_document OF i_oi_document_proxy
IMPORTING document_proxy
has_changed.
etc...
2016 Feb 10 8:38 AM
Hi.
Did you put in all your PAI module:
CALL METHOD cl_gui_cfw=>dispatch IMPORTING return_code = return_code.
while the desktop application is active, include the following method call for dispatching control framework events.
After that your process flow seems complete.
1 - Registering the event in the INIT method;
2 - Processing logic for your events in a class of your own was created;
3 - Initializing the document with "get_document_proxy" method, definining event handling;
4 - method call for dispatching control (this one above I wrote).
Hope to help
Bye
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |