Tuesday, April 11, 2017

Table Control with Uploading from Clip Board

Sometimes we just need to copy & paste a lot of records into table control. Now table control lines are specific (say 13 lines) as per design level. If we want to paste more lines (say 100) into this table control then it will not happen. In this case the system will paste only first 13 lines into the table control which is visible though the copy is there (RAM). At this point we need to paste total 100 lines into that table control.

We cannot achieve this by just paste (ctrl + v) option. Here we create a button by which we shall achieve this purpose. This button functions exactly like ‘Upload from Clip Board’ which is standard. Here we need to call method: cl_gui_frontend_services=>clipboard_import

This method generates an internal table which contains the total copy data. If we select only one field then the table will have only one field. If we select more than one field then internal table will have more than one field. Hence the table structure depends on the selected copy.


In the following example we just create a table control.

INCLUDE ztabc_top                               .  " global Data
INCLUDE ztabc_o01                               .  " PBO-Modules
INCLUDE ztabc_i01                               .  " PAI-Modules
INCLUDE ztabc_f01                               .  " FORM-Routines 

Top Include:

TABLESzsd_pallet_ser.
TYPESBEGIN OF ty_ser,
         sernr TYPE zsd_pallet_ser-sernr,
       END OF ty_ser.
DATAwa_ser TYPE ty_ser,
      it_ser TYPE TABLE OF ty_ser.

DATAok_code_9000 TYPE sy-ucomm.

CONTROLStabc_9000 TYPE TABLEVIEW USING SCREEN 9000.

PBO Include:

MODULE status_9000 OUTPUT.
  SET PF-STATUS 'PF_9000'.
  SET TITLEBAR 'T_9000'.
ENDMODULE.

MODULE tabc_9000_pbo OUTPUT.

  DESCRIBE TABLE it_ser LINES sy-dbcnt.
  tabc_9000-current_line sy-loopc.
  tabc_9000-lines sy-dbcnt.

  zsd_pallet_ser-sernr wa_ser-sernr.

ENDMODULE.

PAI Include:

MODULE user_command_9000 INPUT.

  CASE ok_code_9000.
    WHEN 'BACK'.
      PERFORM back_9000.
    WHEN 'UPL'.
      PERFORM upload_data.
  ENDCASE.

ENDMODULE.

MODULE tabc_9000_pai INPUT.

  READ TABLE it_ser INTO wa_ser INDEX tabc_9000-current_line.
  IF sy-subrc 0.
    MODIFY it_ser FROM wa_ser INDEX tabc_9000-current_line.
  ENDIF.

ENDMODULE.

Form Include:

FORM back_9000 .

  CLEARok_code_9000.
  LEAVE PROGRAM.

ENDFORM.

FORM upload_data .

  TYPESBEGIN OF ty_clip,
           data TYPE char18,
         END OF ty_clip.

  DATAit_clip TYPE TABLE OF ty_clip,
        wa_clip TYPE ty_clip.

  CALL METHOD cl_gui_frontend_services=>clipboard_import
    IMPORTING
      data                 it_clip
    EXCEPTIONS
      cntl_error           1
      error_no_gui         2
      not_supported_by_gui 3
      OTHERS               4.

  IF sy-subrc 0.
    LOOP AT it_clip INTO wa_clip.
      wa_ser-sernr wa_clip-data.
      APPEND wa_ser TO it_ser.
      CLEARwa_serwa_clip.
    ENDLOOP.
  ENDIF.

  CLEAR ok_code_9000.

ENDFORM.

Here we have generated the internal table by that method and then populate the table control’s internal table. To avoid duplicate entries we just clear the OK code inside there.

Now create a T-code and execute it. The table control will look like follows. We have created an upload button to copy from clipboard. In the visible section we have only 13 rows.


Now from excel we have selected 25 rows and copy (ctrl + c) it.


Now go to SAP screen and click on UPLOAD button. The 25 rows have been inserted and only 13 rows are visible because of table control design.


Now we scroll and check whether the purpose got successful or not.




31 comments:

Video Tutorials said...



Thanks for Sharing this Information.You are providing very valuable information. Sap videos

sanayamohit said...

SAP Success Factors Real Time Hands on Training in Chennai...

Don't always Depend on Training Institute Alone and so please aware of Best Trainers too..

http://thecreatingexperts.com/sap-successfactors-training-in-chennai/

If You need a Best Trainer over SAP Success Factors Means??? Please ready for an DEMO From the Trainer MR.Karthick
CONTACT:8122241286

Both Classroom/Online Training is Available!!!!!!

Reddy sap installation said...


Fabulous..!!! The information you Provided is much useful. sap video

SUN TRAININGS said...

Thank u sharing a good information for SAP ABAP SAPABAP_Online_Training

Unknown said...

SAP Success Factors Real Time Hands on Training in Chennai…

Don’t always Depend on Training Institute alone.Please aware of Best Trainers too..

http://thecreatingexperts.com/sap-successfactors-training-in-chennai/

If You need a Best Trainer in SAP Success Factors??? Then be ready for a DEMO From the Trainer MR.Karthick
CONTACT:8122241286

Both Classroom/Online Training is Available!!!!!!

Unknown said...

SAP Success Factors Real Time Hands on Training in Chennai…

Don’t always Depend on Training Institute alone.Please aware of Best Trainers too..

http://thecreatingexperts.com/sap-successfactors-training-in-chennai/

If You need a Best Trainer in SAP Success Factors??? Then be ready for a DEMO From the Trainer MR.Karthick
CONTACT:8122241286

Both Classroom/Online Training is Available!!!!!!

Shruti Ramalingam said...

From My search…Creating Experts provides Best SAP Training with real time projects assistance.

Most of the modules are equipped with advance level topics which the student can learn from the basics to the advance level stage.

They also provide placement assistance in leading MNC companies across the globe according to the current requirements.

http://thecreatingexperts.com/sap-successfactors-training-in-chennai/

And these are the Best SAP training institute which provides Real Time Hands on Training…

codedion Technologies-9003085882

creating Experts-8122241286

http://thecreatingexperts.com/sap-mm-training-in-chennai/

sushma said...

SAP Success Factors Real Time Hands on Training in Chennai…

Don’t always Depend on Training Institute alone.Please aware of Best Trainers too..

http://thecreatingexperts.com/sap-successfactors-training-in-chennai/

If You need a Best Trainer in SAP Success Factors??? Then be ready for a DEMO From the Trainer MR.Karthick
CONTACT:8122241286
http://thecreatingexperts.com/sap-mm-training-in-chennai/

Both Classroom/Online Training is Available!!!!!!

Video Tutorials said...

Thank you. sir, Really I like your post on. sap video tutorials

simashree said...

SAP Success Factors Real Time Hands on Training in Chennai…

Don’t always Depend on Training Institute alone.Please aware of Best Trainers too..

http://thecreatingexperts.com/sap-successfactors-training-in-chennai/

If You need a Best Trainer in SAP Success Factors??? Then be ready for a DEMO From the Trainer MR.Karthick
CONTACT:8122241286
http://thecreatingexperts.com/sap-mm-training-in-chennai/

Both Classroom/Online Training is Available!!!!!!

Priyasekar said...

Very informative blog...SAP ABAP real Time Hands on Training in Chennai…

http://thecreatingexperts.com/sap-abap-training-in-chennai/

CONTACT:8122241286

Both Classroom/Online Training is Available.

ragu varan said...

Best SAP HANA Training in Chennai by leading HANA Consultant.
Reach at 9003085882
http://thecreatingexperts.com/category/sap-hana-training-in-chennai/

Reddy sap installation said...

The information you have given here is truly helpful to me. sap training videos

Reddy sap installation said...


Thanks for Nice and Informative Post on. sap video

Video Tutorials said...

Thanks for the detailed info about SAP. sap video

Reddy sap installation said...


Fabulous..!!! The information you Provided is much useful. sap training videos

Video Tutorials said...

Thank you for information excellent blog have a great possible sap video tutorials

Reddy sap installation said...


Thanks for the great information in your blog on. sapvideos

Video Tutorials said...

I am very grateful to you that you share very informative post with us sap videos

Reddy sap installation said...

The information you posted here is useful to make my career better keep updates.sap video tutorials

Video Tutorials said...

This article is really contains lot more information. sap video

Reddy sap installation said...


Thanks for Nice and Informative Post on. sapvideos

Video Tutorials said...

I get a lot of great information from this blog on. sap video

Reddy sap installation said...


Thank you for giving this best information. It’s a very nice topic. sapvideos

Reddy sap installation said...

it has great information it is very useful Post sap videos online

Reddy sap installation said...


Thanks for sharing this informative blog..Your blog is really useful for me. sap video training

Reddy sap installation said...


This article is really contains lot more information. Sap videos

Video Tutorials said...

Fabulous..!!! The information you Provided is much useful. sap training videos

Reddy sap installation said...


Thanks for Nice and Informative Post on. sap video training

JAIMEGARCIA said...

Thanks a lot !!!!

gilledashivani said...

Great information. the information provided is of great use as i got to learn new things. If you are looking for real time training in SAP ABAP, kindly contact sieve software
Sieve software offers real time training by industry experts with live projects and placement support.
SAP ABAP TRAINING IN HYDERABAD