‎2008 Jul 24 7:48 AM
Hi All,
I have a table control. I am trying to copy records from an excel file and pasting it into Table control.
But it is pasting records only up to the displayed rows of table control. Suppose 25 rows are initially displayed in table control, then only 25 records are pasted. But if i copy 30 records (or more than 25 records), then also it will paste first 25 records and rest will be ignored.
Please suggest any solution for this.
Regards,
Neha.
‎2008 Jul 24 7:51 AM
Neha
try to copy with Ctrl+Y than select all rown than paste.
Amit.
‎2008 Jul 24 8:08 AM
I need to copy data from EXCEL to TABLE CONTROL not from table control to excel.
‎2008 Jul 24 7:53 AM
Hi each time in PBO you use
REFRESH : ITAB[].
where itab[] is the table which u are using for table controll.
Then write
itab [ ] = itab_excel [ ].
where itab_excel[] is the table in which you capture the data from the excel.
Hope the above works...
Edited by: Rudra Prasanna Mohapatra on Jul 24, 2008 8:53 AM
‎2008 Jul 24 7:54 AM
yes only 25 records you can paste each time, not more than that
if you want the prosess more faster use FM to upload data from exel sheet to internal table
which the table control will fill
‎2008 Jul 24 8:04 AM
‎2008 Jul 24 8:00 AM
Hi,
select lines in table control as the number of lines you copied in the excel sheet and paste u can solve your problem i think.
‎2015 Dec 21 4:47 AM
PROCESS BEFORE OUTPUT.
LOOP WITH CONTROL EMP_TC.
ENDLOOP.
PROCESS AFTER INPUT.
MODULE COPY_PASTY_DATA.
LOOP WITH CONTROL EMP_TC.
ENDLOOP.
Write one module above table control as shown above.
write below code in that module (not exact code modify names as u declared)
TYPES:TY_CHAR TYPE C LENGTH 255.
DATA:LT_COPY TYPE STANDARD TABLE OF TY_CHAR,
LS_COPY TYPE TY_CHAR,
LV_LEN TYPE I,
LV_RC TYPE I.
DATA:LS_COPYP TYPE TY_COPYP,
LS_ZEMP TYPE ZEMP_TRREG.
DATA:LS_PA0001 TYPE PA0001,
LT_PA0001 TYPE STANDARD TABLE OF PA0001.
* this for get copied code *
CALL METHOD CL_GUI_FRONTEND_SERVICES=>CLIPBOARD_IMPORT
IMPORTING
DATA = LT_COPY
LENGTH = LV_LEN
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4.
IF LT_COPY[] IS NOT INITIAL AND LV_LEN <> 0. " checking copied data is there or not
CLEAR GV_COPYP.
GV_COPYP = 'X'.
* this converting copied string into our table control data structure*
LOOP AT LT_COPY INTO LS_COPY.
CLEAR LS_COPYP.
SPLIT LS_COPY AT CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB INTO
LS_COPYP-PERNR LS_COPYP-ENAME LS_COPYP-DEPARTMENT
LS_COPYP-SUBAREA LS_COPYP-SDATE LS_COPYP-EDATE
LS_COPYP-STIME LS_COPYP-ETIME LS_COPYP-DESCRIPTION
LS_COPYP-PROG_TYPE LS_COPYP-CONSULT_NAME LS_COPYP-VENUE
LS_COPYP-TRTYPE LS_COPYP-REASON.
CLEAR LS_ZEMP.
MOVE-CORRESPONDING LS_COPYP TO LS_ZEMP.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = LS_ZEMP-PERNR
IMPORTING
OUTPUT = LS_ZEMP-PERNR.
CLEAR:LS_ZEMP-SDATE,LS_ZEMP-EDATE,LS_ZEMP-STIME,LS_ZEMP-ETIME.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
DATE_EXTERNAL = LS_COPYP-SDATE
IMPORTING
DATE_INTERNAL = LS_ZEMP-SDATE
EXCEPTIONS
DATE_EXTERNAL_IS_INVALID = 1
OTHERS = 2.
CALL FUNCTION 'CONVERT_DATE_TO_INTERNAL'
EXPORTING
DATE_EXTERNAL = LS_COPYP-EDATE
IMPORTING
DATE_INTERNAL = LS_ZEMP-EDATE
EXCEPTIONS
DATE_EXTERNAL_IS_INVALID = 1
OTHERS = 2.
REPLACE ALL OCCURRENCES OF ':' IN LS_COPYP-STIME WITH ' '.
REPLACE ALL OCCURRENCES OF ':' IN LS_COPYP-ETIME WITH ' '.
CONDENSE:LS_COPYP-STIME NO-GAPS,
LS_COPYP-ETIME NO-GAPS.
LS_ZEMP-STIME = LS_COPYP-STIME.
LS_ZEMP-ETIME = LS_COPYP-ETIME.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = LS_ZEMP-STIME
IMPORTING
OUTPUT = LS_ZEMP-STIME.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = LS_ZEMP-ETIME
IMPORTING
OUTPUT = LS_ZEMP-ETIME.
GV_TRNO = GV_TRNO + 1.
LS_ZEMP-TRNO = GV_TRNO.
CLEAR LS_PA0001.
SELECT * FROM PA0001 INTO TABLE LT_PA0001 WHERE PERNR = LS_ZEMP-PERNR.
SORT LT_PA0001 BY AEDTM DESCENDING.
CLEAR LS_PA0001.
READ TABLE LT_PA0001 INTO LS_PA0001 WITH KEY ENDDA = '99991231'.
LS_ZEMP-ENAME = LS_PA0001-ENAME.
LS_ZEMP-DEPARTMENT = LS_PA0001-ZZDEPARTMENT.
* adding structure to table control table*
APPEND LS_ZEMP TO GT_ZEMP.
ENDLOOP.
* set table controls lines
PERFORM SET_TC_LINES.
* for set copied data is null, for next command *
REFRESH:LT_COPY[].
CALL METHOD CL_GUI_FRONTEND_SERVICES=>CLIPBOARD_EXPORT
IMPORTING
DATA = LT_COPY
CHANGING
RC = LV_RC
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
NO_AUTHORITY = 4
OTHERS = 5.
ELSE.
CLEAR GV_COPYP.
ENDIF.
‎2015 Dec 21 4:47 AM
PROCESS BEFORE OUTPUT.
LOOP WITH CONTROL EMP_TC.
ENDLOOP.
PROCESS AFTER INPUT.
MODULE COPY_PASTY_DATA.
LOOP WITH CONTROL EMP_TC.
ENDLOOP.
Write one module above table control as shown above.
write below code in that module (not exact code modify names as u declared)
* this for get copied code *
CALL METHOD CL_GUI_FRONTEND_SERVICES=>CLIPBOARD_IMPORT
IMPORTING
DATA = LT_COPY
LENGTH = LV_LEN
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4.
IF LT_COPY[] IS NOT INITIAL AND LV_LEN <> 0. " checking copied data is there or not
* this converting copied string into our table control data structure*
LOOP AT LT_COPY INTO LS_COPY.
CLEAR LS_COPYP.
SPLIT LS_COPY AT CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB INTO
LS_COPYP-PERNR LS_COPYP-ENAME LS_COPYP-DEPARTMENT
LS_COPYP-SUBAREA LS_COPYP-SDATE LS_COPYP-EDATE
LS_COPYP-STIME LS_COPYP-ETIME LS_COPYP-DESCRIPTION
LS_COPYP-PROG_TYPE LS_COPYP-CONSULT_NAME LS_COPYP-VENUE
LS_COPYP-TRTYPE LS_COPYP-REASON.
CLEAR LS_ZEMP.
MOVE-CORRESPONDING LS_COPYP TO LS_ZEMP.
* adding structure to table control table*
APPEND LS_ZEMP TO GT_ZEMP.
ENDLOOP.
* set table controls lines
tablecontrol-lines = tablecontrol-lines + no of recods to be display or copied.
* for set copied data is null, for next command *
REFRESH:LT_COPY[].
CALL METHOD CL_GUI_FRONTEND_SERVICES=>CLIPBOARD_EXPORT
IMPORTING
DATA = LT_COPY
CHANGING
RC = LV_RC
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
NO_AUTHORITY = 4
OTHERS = 5.
ENDIF.