Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Clear Clipboard

Former Member
0 Kudos

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

8 REPLIES 8

arindam_m
Active Contributor
0 Kudos

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

former_member184569
Active Contributor
0 Kudos

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,

0 Kudos

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".

0 Kudos

Former Member
0 Kudos

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.

Former Member
0 Kudos

Hi Cipriano,

Try using CL_CLIPBOARD_RFW->CLEAR


former_member594638
Discoverer

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.

You know the question was asked ten years ago... and the poster is no longer a member of the site?