07-12-2013 8:31 PM
Hi,
hope you can help me.
I have to copy an internal table into Excel. To do that:
1. I copy the table in the clipboard (CALL METHOD cl_gui_frontend_services=>clipboard_export)
2. I paste it in excel ( CALL METHOD OF w_excel 'Paste' .)
till now, everything work fine.
I need now to clear the clipboard (because, i repeat step 1 & 2 a few times).
someone propose to clipoard_export an empty table. It does'nt work.
Another "solution" was SET PROPERTY OF 'CutCopyMode' = 0. But again no success.
If you can help me to find a way to clear the clipboard between each export/paste, it would be great.
thank you,
Hector
07-13-2013 7:05 AM
Hi,
The clipboard data belongs to the client workstation. I think the method gives limited access to just fetch and put the data on clipboard. It does not have an explicit control on the clipboard memory from which it just reads or loads the data into using the methods
Also the kind of data we can import or export is limited in nature as to be ANSI or UNICODE text, where as the clipboard specially on windows based client can hold other data to. So I think its very limited access and there is limited access to the clipboard memory.
Cheers,
Arindam
07-13-2013 6:40 PM
You can just perform an additional export of an empty internal table to clear clip board after the paste command
REFRESH excel_tab. "or CLEAR excel_tab
CALL METHOD cl_gui_frontend_services=>clipboard_export
IMPORTING
data = excel_tab
CHANGING
rc = ld_rc
EXCEPTIONS
cntl_error = 1
* ERROR_NO_GUI = 2
* NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4.
Regards,
07-13-2013 6:49 PM
Thank you for the answer but, as i said, i have already try this solution and it didn't clear the clipboard.
If i remember well, i had the message "item not collected".
07-14-2013 2:53 PM
Can you check this sample code?
http://hi.baidu.com/foraquarius/item/1e6727f5c61a6a713d198bfc
07-14-2013 4:59 AM
Try this (I think this should do the trick):
..... " do your processing LOOP/ENDLOOP....processing before calling your methods
*" clear table LT_ITAB2.
*" prepare table -> LT_ITAB2
*" Create a new class and method with input/output parameters
*" and call CLIPBOARD_EXPORT and PASTE method inside this
*" new method
CALL METHOD ZCL_CLIPBOARD->PASTE_EXCEL
IMPORTING
IT_TABLE = LT_ITAB2
.....
EXPORTING
.....
.....
*"""""""""""" Above Class Method ************
METHOD PASTE_EXCEL.
1. I copy the table in the clipboard (CALL METHOD cl_gui_frontend_services=>clipboard_export)
2. I paste it in excel ( CALL METHOD OF w_excel 'Paste' .)
ENDMETHOD.
07-15-2013 5:03 AM
04-26-2023 2:20 AM
I tried with
SET PROPERTY OF lwa_application 'CutCopyMode' = 0.
This sentence is work for me.
I suppose your problem not to use the main variable.
the variable is the same with this.
CREATE OBJECT lwa_application
'Excel.Application'.
I hope that help you.
04-26-2023 8:42 AM
You know the question was asked ten years ago... and the poster is no longer a member of the site?