Application Development and Automation 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: 
Read only

copy paste within table control

Former Member
0 Likes
2,285

Hi to all,

i have created table control with wizard. and i'm uploading the data into table control from excel ****, after upload function i'm getting all rows from excel sheet to table control and i'm saving this into on customized table now my requirement is that i need to do copy-paste function within table control itself. Suppose user copy some rows from table control and again paste within same table control, how shall i achieve this functionality? how can i use mark field or cursor-field from table control structure?

Thanks in Advance...

6 REPLIES 6
Read only

Former Member
0 Likes
1,271

Hi,

You could try something like this

Have two buttons 'COPY' and 'PASTE' as sub functional buttons for the table control. Go to the layout of your table control -> Check the w/sel column and give a name lets say 'MARK'. We get the selection column on the table control.

In your TOP, declare a field for 'MARK' in your internal table (that which is in synch with your table control) like this


data: begin of it_tab occurs 0,
             check(1) type c,
             --------------
         end of it_tab.

Now, in the PAI inside the module enclosed with LOOP...ENDLOOP for the table control, write the functionality.


PROCESS BEFORE OUTPUT.
LOOP AT it_tab WITH CONTROL tcl.
 MODULE check_data.
ENDLOOP.

PROCESS AFTER INPUT.
MODULE clear_internal_table.
LOOP AT it_tab.
 MODULE it_itab_mod.
ENDLOOP.

MODULE clear_internal_table INPUT.
  clear it_tab[].
ENDMODULE.

MODULE it_itab_mod INPUT.
  wa_tab-check = mark. "Transfer the status of mark field on table control to internal table that is select the fields you want to copy
  case sy-ucomm.
   when 'F_COPY'.
         if wa_tab-check = 'X'.
            wa_tab_temp = wa_tab.
            append wa_tab_temp to it_tab_temp.
         endif.
 endcase.
ENDMODULE.

MODULE check_data OUTPUT.
   if sy-ucomm eq 'F_PASTE'.   
     ztable-field1 = wa_tab-field1.
     ztable-field2 = wa_tab-field2. 
  endif.
ENDMODULE.

P.S. This is just a rough template. Try building on the core logic according to your requirement and convenience.

Read only

Former Member
0 Likes
1,271

Hi,

I want to use ctrlC and ctrlV keys within table control. Please suggest.

Thanks

Read only

0 Likes
1,271

Hi,

To my knowledge I dont know of a method that can capture such keyboard events (except for a few ).

Read only

0 Likes
1,271

i tried with CL_TABLECONTROL class but it's not working. i dont know which exact method or attribute i need to use for this..do you have any idea

Read only

Former Member
0 Likes
1,271

>

> uploading the data into table control from excel ****,

>

This is a professional forum. Kindly check your spelling

Read only

0 Likes
1,271

please ignore the above.Done by mistake

Pranjal11 wrote:uploading the data into table control from excel sheet,