Using ALSM_EXCEL_TO_INTERNAL_TABLE
Dear experts,
As my scenario, I have a web dynpro, and what I must do is import an Excel file from client to SAP back-end. I created a BAPI using the function module ALSM_EXCEL_TO_INTERNAL_TABLE to import Excel data to internal table and then processing in SAP. But unfortunately, when I run the web, it throws an error: Error during import of clipboard contents, error key: RFC_ERROR_SYSTEM_FAILURE. Have you guys ever met this problem? Please show me the the solution, or guide me how to fix this error.
Thanks in advance.
HI,
I have the same problem now,and I can't understand what should I do. can you explain it in detail? how to check and load the correct template?where to find the template?Thanks!!!
Similar Messages
-
Uploading Excel file using 'ALSM_EXCEL_TO_INTERNAL_TABLE'
Hi,
I am uploading excel file into an internal table using 'ALSM_EXCEL_TO_INTERNAL_TABLE' FM.
but I'm getting a popup with the message
'There is a large amount of the information on the clipboard. Do you want to be able to paste this information into another programme later.' and there are three buttons in the popup 'YES', 'CANCEL' and 'NO'. but for any choice there is no data in the internal table.
the progrsm is working in other systems but giving problem in customer laptop, can you please tell me is there any settings need to set for EXCEL or SAP.
system details are as below
OS: windows 7
MS-Office - 2007
SAP : ECC06Looks like there was an intention to clear the clipboard in the code, but this does not seem to work.
I copied the function module to my own version and added the following code, which seems to work :
* clear clipboard
refresh 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
* Copy only one cell to prevent the clipboard data message.
call method of worksheet 'Cells' = h_cell
exporting #1 = 1 #2 = 1.
m_message.
call method of worksheet 'Cells' = h_cell1
exporting #1 = 1 #2 = 1.
m_message.
call method of worksheet 'RANGE' = range
exporting #1 = h_cell #2 = h_cell1.
m_message.
call method of range 'SELECT'.
m_message.
* copy marked area (whole spread sheet) into Clippboard
call method of range 'COPY'.
m_message.
* quit Excel and free ABAP Object - unfortunately, this does not kill
* the Excel process
call method of application 'QUIT'.
m_message. -
Hi Experts,
I am getting sy-subrc = 2 while uploading the file using ALSM_EXCEL_TO_INTERNAL_TABLE wiht message OLE upload error.
If i upload the same file in another system it is not giving any error.
I want to know in which situation we will get this error & who will resolve this error means either basis,technical or admin.
Please give me the best answer to resolve this issue.Hi Naresh,
If i upload the same file in another system it is not giving any error.
if it is working fine in another system , it seems the rights issue in your system try to login with admin rights.
Regards
Parveen -
Problems using ALSM_EXCEL_TO_INTERNAL_TABLE in Web Dynpro ABAP
Hello experts, im using the fm ALSM_EXCEL_TO_INTERNAL_TABLE.
When i call this fm from a web dynpro i have a dump that says that cannot import the clipboard.
Any ideas why this is happening?
(The parameter of the function are Ok, becouse if I call the function from SAP/R3 everything work fine)
ThankS!>
Mariano Gallicchio wrote:
> Thanks for the answer!
>
> I will continue searching for other fm!
I didn't mean to imply that there is a Function Module that should work from Web Dynpro. In fact I would be highly suprised if there was one. As already posted in this forum, the only way to get data from the client desktop is with the fileUpload UI element. No function module is going to be able to work with the Web Dynpro UI element. -
Error while using ALSM_EXCEL_TO_INTERNAL_TABLE
I am getting the exception "Upload OLE" while using this FM to upload data from excel sheet into SAP system. It errors out at the following statement inside the FM -
CREATE OBJECT obj_application 'Excel.Application'.
Any pointers?
Regards,
Shivalihi, take a look at this code
*& Report ZKRIS_OLE3_PALETTE
*& Displays the full OLE color range in excel
REPORT ZKRIS_OLE3_PALETTE.
TYPE-POOLS ole2 .
DATA: count TYPE i,
count_real TYPE i,
application TYPE ole2_object,
workbook TYPE ole2_object,
excel TYPE ole2_object,
sheet TYPE ole2_object,
cells TYPE ole2_object.
CONSTANTS: row_max TYPE i VALUE 256. " change to 16384 for excel 2007
DATA index TYPE i.
DATA:
h_cell TYPE ole2_object, " cell
h_f TYPE ole2_object, " font
h_int TYPE ole2_object,
h_width TYPE ole2_object,
h_columns TYPE ole2_object,
h_rows TYPE ole2_object,
h_font TYPE ole2_object,
h_entirecol TYPE ole2_object.
DATA: h_range TYPE ole2_object.
DATA: h_merge TYPE ole2_object.
CREATE OBJECT excel 'EXCEL.APPLICATION'.
IF sy-subrc NE 0.
WRITE: / 'No EXCEL creation possible'.
STOP.
ENDIF.
SET PROPERTY OF excel 'DisplayAlerts' = 0.
CALL METHOD OF excel 'WORKBOOKS' = workbook .
SET PROPERTY OF excel 'VISIBLE' = 1.
creating workbook
SET PROPERTY OF excel 'SheetsInNewWorkbook' = 1.
CALL METHOD OF workbook 'ADD'.
CALL METHOD OF excel 'WORKSHEETS' = sheet
EXPORTING
#1 = 1.
SET PROPERTY OF sheet 'NAME' = 'Color Palette'.
CALL METHOD OF sheet 'ACTIVATE'.
DATA: col TYPE i VALUE 1,
row TYPE i VALUE 2,
col1 TYPE i VALUE 2,
col_real TYPE i VALUE 1.
row = 1.
col = 3.
CALL METHOD OF excel 'Cells' = h_cell
EXPORTING
#1 = row
#2 = col.
SET PROPERTY OF h_cell 'Value' = 'No.'.
col = col + 1.
CALL METHOD OF excel 'Cells' = h_cell
EXPORTING
#1 = row
#2 = col.
SET PROPERTY OF h_cell 'Value' = 'Background'.
col = col + 1.
CALL METHOD OF excel 'Cells' = h_cell
EXPORTING
#1 = row
#2 = col.
SET PROPERTY OF h_cell 'Value' = 'Foreground with white background'.
col = col + 1.
CALL METHOD OF excel 'Cells' = h_cell
EXPORTING
#1 = row
#2 = col.
SET PROPERTY OF h_cell 'Value' = 'Foreground with black background'.
CALL METHOD OF excel 'Rows' = h_rows
EXPORTING
#1 = '2:2'.
SET PROPERTY OF h_rows 'WrapText' = 1.
col = 9.
CALL METHOD OF excel 'Cells' = h_cell
EXPORTING
#1 = row
#2 = col.
SET PROPERTY OF h_cell 'Value' = 'No.'.
col = col + 1.
CALL METHOD OF excel 'Cells' = h_cell
EXPORTING
#1 = row
#2 = col.
SET PROPERTY OF h_cell 'Value' = 'Background'.
col = col + 1.
CALL METHOD OF excel 'Cells' = h_cell
EXPORTING
#1 = row
#2 = col.
SET PROPERTY OF h_cell 'Value' = 'Foreground with white background'.
SET PROPERTY OF h_cell 'Bold' = 1.
col = col + 1.
CALL METHOD OF excel 'Cells' = h_cell
EXPORTING
#1 = row
#2 = col.
SET PROPERTY OF h_cell 'Value' = 'Foreground with black background'.
CALL METHOD OF excel 'Rows' = h_rows
EXPORTING
#1 = '1:1'.
SET PROPERTY OF h_rows 'WrapText' = 1.
GET PROPERTY OF h_rows 'Font' = h_font.
SET PROPERTY OF h_font 'Bold' = 1.
count = 1.
count_real = count.
row = 2.
col = 3.
DO 56 TIMES.
PERFORM write_num_and_color.
ENDDO.
autofit
CALL METHOD OF excel 'Columns' = h_columns
EXPORTING
#1 = 'C:L'.
GET PROPERTY OF h_columns 'EntireColumn' = h_entirecol.
SET PROPERTY OF h_entirecol 'Autofit' = 1.
write palette on lhs
*range
CALL METHOD OF excel 'Range' = h_range
EXPORTING
#1 = 'A2'
#2 = 'A20'.
CALL METHOD OF h_range 'Merge' = h_merge .
CALL METHOD OF excel 'Cells' = h_cell
EXPORTING
#1 = 2
#2 = 1.
SET PROPERTY OF h_cell 'Value' = 'Palette'.
SET PROPERTY OF h_cell 'Orientation' = 90. "angled.
SET PROPERTY OF h_cell 'HorizontalAlignment' = 3. "center align
GET PROPERTY OF h_cell 'Font' = h_f.
SET PROPERTY OF h_f 'Bold' = 1. "bold
SET PROPERTY OF h_f 'Name' = 'Comic Sans MS'.
SET PROPERTY OF h_f 'Size' = '14'.
SET PROPERTY OF h_cell 'VerticalAlignment' = 2. "center align
autofit
CALL METHOD OF excel 'Columns' = h_columns
EXPORTING
#1 = 'A:A'.
GET PROPERTY OF h_columns 'EntireColumn' = h_entirecol.
SET PROPERTY OF h_columns 'ColumnWidth' = 4.
*& Form write_num_and_color
text
FORM write_num_and_color.
index = row_max * ( row - 1 ) + col.
CALL METHOD OF sheet 'Cells' = cells
EXPORTING
#1 = index.
SET PROPERTY OF cells 'Value' = count_real.
col = col + 1.
CALL METHOD OF excel 'Cells' = h_cell
EXPORTING
#1 = row
#2 = col.
GET PROPERTY OF h_cell 'Interior' = h_int.
SET PROPERTY OF h_int 'ColorIndex' = count_real.
col = col + 1.
CALL METHOD OF excel 'Cells' = h_cell
EXPORTING
#1 = row
#2 = col.
SET PROPERTY OF h_cell 'Value' = 'Sample Text'.
GET PROPERTY OF h_cell 'Font' = h_f.
SET PROPERTY OF h_f 'ColorIndex' = count_real.
col = col + 1.
CALL METHOD OF excel 'Cells' = h_cell
EXPORTING
#1 = row
#2 = col.
GET PROPERTY OF h_cell 'Interior' = h_int.
SET PROPERTY OF h_int 'ColorIndex' = 1.
SET PROPERTY OF h_cell 'Value' = 'Sample Text'.
GET PROPERTY OF h_cell 'Font' = h_f.
SET PROPERTY OF h_f 'ColorIndex' = count_real.
row = row + 1.
col = col - 3.
count = count + 1.
IF count = 29.
count = 1.
row = 2.
col = col + 6.
ENDIF.
count_real = count_real + 1.
ENDFORM. "write_num_and_color
hope this helps.
regs,
hema. -
Incorrect result using the function ALSM_EXCEL_TO_INTERNAL_TABLE
I have used the function ALSM_EXCEL_TO_INTERNAL_TABLE to load a Excel sheet on an internal table and the function returns the following result:
Row Col Value
0001 0001 902000100 A601 K 627542130 021 AGARDUN ZMAS 673 EU
0002 0001 902000101 A602 K 627542131 022 AGARDUN ZMAS 695 EU
0003 0001 902000102 A603 K 627542132 023 AGARDUN ZMAS 717 EU
0004 0001 902000103 A604 k 627542133 024 AGARDUN ZMAS 739 EU
0005 0001 902000104 A605 k 627542134 025 AGARDUN ZMAS 761 EU
0006 0001 902000105 A606 W 627542135 026 AGARDUN ZMAS 783 EU
0007 0001 902000106 A607 W 627542136 027 AGARDUN ZMAS 805 EU
0008 0001 902000107 A608 W 627542137 028 AGARDUN ZMAS 827 EU
0009 0001 902000108 A609 K 627542138 029 AGARDUN ZMAS 849 EU
0010 0001 902000109 A610 k 627542139 030 AGARDUN ZMAS 871 EU
0011 0001 902000110 A611 O 627542140 031 AGARDUN ZMAS 893 EU
That is to say, the excel sheet has nine columns, and the function thinks that only has 1 column.
I have checked the function with the same file in other computers, and the result has been the correct one, that is to say, the function returns the value of the column in its corresponding column:
Row Col Value
0001 0001 902000100
0001 0002 A601
0001 0003 K
0001 0004 627542130
0001 0005 021
0001 0006 AGARDUN
0001 0007 ZMAS
0001 0008 673
0001 0009 EU
0002 0001 902000101
0002 0002 A602
0002 0003 K
0002 0004 627542131
0002 0005 022
0002 0006 AGARDUN
0002 0007 ZMAS
0002 0008 717
0002 0009 EU
Can you help me?
Thanks.Hi Garduño,
1. U want to upload data from EXCEL
into internal table.
2. and u are using ALSM_EXCEL_TO_INTERNAL_TABLE.
3. But We cannot do this direclty !
For uploading purpose :
6. There are TWO options.
a) either save the excel to TAB Delimited file,
and use GUI_UPLOAD to upload the data in internal table.
b) use FM for excel purpose.
7. a) is easy and recommended
8. b) there is a FM for it,
but we have to apply some more logic
bcos the FM uploads data of excel
in the intenal table,
CELL BY CELL
9. afTER THAT , we have to convert this cell by cell data,
into our format of internal table.
10. use this code (just copy paste in new program)
(it is tried wit T001 structure data)
(it will AUTOMATICALLY based upon the
fields of internal table,
convert data from cell by cell,
to that of internal table fields)
REPORT abc.
DATA : ex LIKE TABLE OF alsmex_tabline WITH HEADER LINE.
DATA : t001 LIKE TABLE OF t001 WITH HEADER LINE.
DATA : cmp LIKE TABLE OF rstrucinfo WITH HEADER LINE.
DATA : col TYPE i.
DATA : col1 TYPE i.
FIELD-SYMBOLS : .
DATA : fldname(50) TYPE c.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = 'd:def.xls'
i_begin_col = 1
i_begin_row = 1
i_end_col = 100
i_end_row = 100
TABLES
intern = ex
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
BREAK-POINT.
CALL FUNCTION 'GET_COMPONENT_LIST'
EXPORTING
program = sy-repid
fieldname = 'T001'
TABLES
components = cmp.
LOOP AT ex.
AT NEW row.
IF sy-tabix = ex-value.
ENDLOOP.
BREAK-POINT.
regards,
amit m. -
How to read data from an excel using abap program?
Hi
I have to write an abap program to read the contents of ms excel across various
sheets. Can any one help me regarding this
Thanks in advance
SatishHai Satish,
<b>You save all your Excel sheets as Text Tab Delimited.</b>
And then for each teext file can be uploaded into your daabase table.
See the Report that i have done.
REPORT Z_UPLOAD_TO_DATABASE_TABLE.
TABLES:
ZDETMAST. " Database table to be uploaded
Data declaration of the structure to hold ZDETMAST(zdetcode) data *
DATA:
BEGIN OF FS_ZDETMAST,
CNT(3) TYPE C, " Client
DETCODE(15) TYPE C, " Det Code
DETCAT(1) TYPE C, " Det category
DETTYPE(2) TYPE N, " Det type
DETDESC(30) TYPE C, " Det description
PFLAG(1) TYPE C, " Det Flag
TOTALDR(10) TYPE C, " Total DR
TOTALCR(10) TYPE C, " Total CR
END OF FS_ZDETMAST.
Internal table to hold ZDETMAST(zdetcode) data *
DATA:
T_ZDETMAST LIKE STANDARD TABLE OF FS_ZDETMAST.
Function Module to upload ZDETMAST Data
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'D:/ZDETMAST_2.TXT'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = 'DAT'
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = T_ZDETMAST
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. " IF SY-SUBRC <> 0.
LOOP AT T_ZDETMAST INTO FS_ZDETMAST.
WRITE:
/ FS_ZDETMAST-CNT,
FS_ZDETMAST-DETCODE,
FS_ZDETMAST-DETCAT,
FS_ZDETMAST-DETTYPE,
FS_ZDETMAST-DETDESC,
FS_ZDETMAST-PFLAG,
FS_ZDETMAST-TOTALDR,
FS_ZDETMAST-TOTALCR.
ENDLOOP. " LOOP AT T_ZDETMAST ...
LOOP AT T_ZDETMAST INTO ZDETMAST.
IF SY-TABIX GE 2.
INSERT ZDETMAST.
DELETE ZDETMAST.
ENDIF. " IF SY-TABIX EQ 2
ENDLOOP. " LOOP AT T_ZDETMAST
Hope this helps you a lot.
<b>You can also use ALSM_EXCEL_TO_INTERNAL_TABLE FM to have excel data in ITAB AND THEN YOU CAN INSERT DATA INTO DATABASE TABLE.</b>
<b>Reward points if it helps you.</b>
Regds,
Rama chary.Pammi -
Excel to internal table upload 'ALSM_EXCEL_TO_INTERNAL_TABLE' issue
I am using ALSM_EXCEL_TO_INTERNAL_TABLE function module to upload the excel into an internal table. In case there is a column with no data. This function module is still populating the previous row data into the internal table
Ex. if the Excel has data like the below 3 rows and 3 columns
1 10 5.0
20
2 6.0
The internal table is posting data like this
1 10 5.0
1 20 5.0
2 20 6.0
Please tell me if i am missing something to be added in the below snip of code
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
FILENAME = p_file
I_BEGIN_COL = B1
I_BEGIN_ROW = C1
I_END_COL = B2
I_END_ROW = C2
TABLES
INTERN = IT_upload
EXCEPTIONS
INCONSISTENT_PARAMETERS = 1
UPLOAD_OLE = 2
OTHERS = 3.
IF SY-SUBRC = 0.
ENDIF.
LOOP AT IT_upload.
CASE IT_Upload-COL.
WHEN 1.
IT_Excel-BILLCO = IT_Upload-VALUE.
WHEN 2.
IT_Excel-PONUM = IT_Upload-VALUE.
WHEN 3.
CLEAR v_upload.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = IT_upload-value
IMPORTING
OUTPUT = v_upload.
IT_Excel-STORENUM = v_upload.
WHEN 4.
IT_Excel-VINVNUM = IT_Upload-VALUE.
WHEN 5.
IT_Excel-LINEITNUM = IT_Upload-VALUE.
WHEN 6.
IT_Excel-LINEITAMT = IT_upload-VALUE.
WHEN 7.
IT_Excel-TAXAMT = IT_upload-VALUE.
WHEN 8.
IT_Excel-TOTAL = IT_upload-VALUE.
ENDCASE.
AT END OF ROW.
APPEND IT_Excel.
ENDAT.
ENDLOOP.Hi,
Please check below link. surely it will help u.
http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=60655105
Thanks
Jitendra -
Information regarding ALSM_EXCEL_TO_INTERNAL_TABLE function module
Hi,
I am using "ALSM_EXCEL_TO_INTERNAL_TABLE" function module for reading 'XLS' file from client machine into internal table. Now question is "IS there is need of Micosoft office installed on client machine for reading excel file to internal table"
ThankuSandip,
No, To display the output in excel it needs. -
ALSM_EXCEL_TO_INTERNAL_TABLE index error
HI All,
Do i have to close my Excel when using ALSM_EXCEL_TO_INTERNAL_TABLE ?
Because some times the codes run properly but the field which is index give 000000000000000000 (NUMC 18).
PS: i use this FM about 10 times to open 1 excel file to fetch different row and col for different tables.
Please help.HI All,
Do i have to close my Excel when using ALSM_EXCEL_TO_INTERNAL_TABLE ?
Because some times the codes run properly but the field which is index give 000000000000000000 (NUMC 18).
PS: i use this FM about 10 times to open 1 excel file to fetch different row and col for different tables.
Please help. -
Alternative to ALSM_EXCEL_TO_INTERNAL_TABLE
Hi,
I am facing some problems when uploading XLS files using ALSM_EXCEL_TO_INTERNAL_TABLE function module. This FM uses the clipboard to pass data from the XLS file to an internal table. Under certain circumstances, this is not achieved and the resulting internal table is empty.
By now, we can workaround this, by restarting the computer and re-loading the file, making sure no other application is in use.
We are uploading Excel 2003 files with 50.000 rows and 30 columns.
Is there any other FM available to read XLS files (not TXT) that doesn't use the clipboard, or at least manage the problem??
thanks for your help.
Mauricio.Hi,
You can use Function module ws_upload to do the same.
e.g.
CALL FUNCTION 'WS_UPLOAD'
EXPORTING
FILENAME = 'D:\Quota_upload.xls' "Change here with quote
FILETYPE = 'DAT'
TABLES
data_tab = int_input
EXCEPTIONS
conversion_error = 1
invalid_table_width = 2
invalid_type = 3
no_batch = 4
unknown_error = 5
gui_refuse_filetransfer = 6
others = 7. -
Problem in 'ALSM_EXCEL_TO_INTERNAL_TABLE'
i m using ALSM_EXCEL_TO_INTERNAL_TABLE for uploading data frm excel sheet to database.I m using Office XP (excel sheet) for uploading data & its working fine.But when i try to upload data from Office 2000(excel sheet)....it is not uploading properly..........can i know the reason.
hi dheeraj,
try to use this FM.
*& Form F_UPLOAD_DATA_FROM_LOCAL_FILE
GET DATA FROM EXCEL FILE AND CONVERT TO SAP FORMAT
-->P_FILE LOCAL FILE NAME
FORM f_upload_data_from_local_file USING p_file.
DATA: loc_filename TYPE rlgrap-filename,
int_raw TYPE truxs_t_text_data.
loc_filename = p_file.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_field_seperator = 'X'
i_line_header = 'X'
i_tab_raw_data = int_raw
i_filename = loc_filename
TABLES
i_tab_converted_data = int_content_lfile
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF sy-subrc NE wl_yes.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
CLEAR : int_record , int_content_lfile ,int_record[].
LOOP AT int_content_lfile.
Moving the records to the Internal table for process
int_record-adm_area = int_content_lfile-adm_area .
int_record-dsrd_loc = int_content_lfile-dsrd_loc.
int_record-fl_ind = int_content_lfile-fl_ind.
int_record-loc_loc = int_content_lfile-loc_loc.
int_record-loc_desc = int_content_lfile-loc_desc .
APPEND int_record.
CLEAR int_record.
ENDLOOP.
ENDFORM. "F_UPLOAD_DATA_FROM_LOCAL_FILE
rgds
anver
if hlped mark points -
I am currently working on a batch upload program for ML81N, reading the file from excel. I have one cell which contains many characters for the transaction's Short Text (ESSR-TXZ01 - maximum 40 charcters)
Now the problem is it cuts the input in the cell up to 32 characters only, cutting the other 8.
I had the field declared in the internal table as:
TYPES: BEGIN OF t_serv,
p_short type essr-txz01,
END OF t_serv,
also tried:
TYPES: BEGIN OF t_serv,
p_short(40) type c,
END OF t_serv,
also tried:
TYPES: BEGIN OF t_serv,
p_short like essr-txz01,
END OF t_serv,
also tried:
TYPES: BEGIN OF t_serv,
p_short(50) type c,
END OF t_serv,
but none of these worked. So I traced and learned that early on at reading from excel from this function
CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
EXPORTING
filename = p_file
i_begin_col = l_start_col
i_begin_row = l_start_row
i_end_col = l_end_col
i_end_row = l_end_row
TABLES
intern = l_intern
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
table l_intern already had it cut. So 'ABCDEFGHIJKLMNOPQRSTUVWXYZhhhhhhhhhhhh' becomes 'ABCDEFGHIJKLMNOPQRSTUVWXYZhhhhhh'
I dont know if it has something to do within the processing inside the function or the Excel format. I had the cell formatted on General and Text, Left Justified, Right Justified and Centered. But it's still cutting it.
I hope someone can help me.. this is a pending issue with my program and I can't have it signed off.... Much thanks to all who can help!KCD_EXCEL_OLE_TO_INT_CONVERT is only limited to 32 char per cell... i used ALSM_EXCEL_TO_INTERNAL_TABLE which allows up to 50 characters
-
Excel Upload with Hidden Column
Hi Gurus-
Can you upload Excel file with hidden column and get the function to read values in hidden column? If yes, could you please guide me how?
I am using ALSM_EXCEL_TO_INTERNAL_TABLE
Any help will be highly appreciated.
Thanks in advance!Hi,
Have a look at program RSDEMO01 (available in the controls examples of the workbench). It demonstrates an OLE connection to Excel.
To know which excel objects, methods and properties to use it is a good idea to use the excel macro recorder - just do what you want your program to do and then translate the resulting VB code to ABAP OLE.
For the import of the clipboard data you can use CL_GUI_FRONTEND_SERVICES=>CLIPBOARD_IMPORT. In the result table, iirc, there is one line for each imported line and within the line the cell values are separated by tab. So there is some work left - it might be a good idea t import the data column by column.
It has been some time when I did this for a former client of me - so unfortunately I do not have the code any more.
Regards, Gerd Rother -
How to load the values in excel sheet directly into the table of smart form
could u help me out of this
Hi krishna,
insert this code in u r smartform print program
parameter p_file type rlgrap-filename.
at selection-screen on value-request for p_file.
CALL FUNCTION 'F4_FILENAME'
EXPORTING
PROGRAM_NAME = SYST-CPROG
DYNPRO_NUMBER = SYST-DYNNR
FIELD_NAME = 'P_FILE'
IMPORTING
FILE_NAME = p_file
start-of-selection.
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
I_FIELD_SEPERATOR =
I_LINE_HEADER = 'X'
i_tab_raw_data = it_type
i_filename = p_file
tables
i_tab_converted_data = itab[]
EXCEPTIONS
CONVERSION_FAILED = 1
OTHERS = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
<b>U can also use ALSM_EXCEL_TO_INTERNAL_TABLE or KCD_EXCEL_OLE_TO_INT_CONVERT</b>
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = wf_filename
i_begin_col = v_start_col
i_begin_row = v_start_row
i_end_col = v_end_col
i_end_row = v_end_row
TABLES
intern = int_excel
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
EXPORTING
filename = p_file
i_begin_col = p_scol
i_begin_row = p_srow
i_end_col = p_ecol
i_end_row = p_erow
TABLES
intern = LT_INTERN
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
Maybe you are looking for
-
Connection from one PI 7.0 system to 2 SAP R/3 systems
Hi XI Experts, There is a requirement as below: I am using PI 7.0 system. This system has to be connected to 2 R/3 systems paralelly. That means, one XI system should be connected to 2 R/3 systems. Request you to suggest the best possible ways to do
-
Small round grey earth is shown on my i mac
a grey small earth icon is appeared on my i mac screen together with the description of the network but cannot connected to the internet .i need to enter my ip adress but there is no way at this stage
-
Migrated CS6 from my desktop to laptop since old one's motherboard died and AE can't find Bridge
Do I really need to reinstall everything or just Bridge? And when I open Bridge separately, it crashes trying to open application folder.
-
STACK 13 ANALYSER DOES NO WORK WITH SAPGUI 6.40
HI, We are not able to use the analyser with the following installation.(Query button are not active) (Query designer is working). STACK 13 SAPGUI 6.40 (SP25) Latest hot fix . Security is not active on excel. When we use the sapgui 7 it's working,
-
Hi, I'm trying to fill a search page with <netui:select> tag. I can see the data in the debug window and in the log file, but when it's suposed to be viewed in the page, everything is empty, and the following message is in netui.log: 31 jan 2007 14:3