2010 Dec 17 7:15 AM
Hi all,
I want to convert the values of a spreadsheetml file (excel xml file) to a internal table.
Are there any standard classes?
I have found a lot of documentation how to create spreadsheetml fiels using abap.
Please don't spread the links about the creation!
I'm only interested in the conversion of such a file.
Thanks
Hi all,
I want to convert the values of a spreadsheetml file (excel xml file) to a internal table.
Are there any standard classes?
I have found a lot of documentation how to create spreadsheetml fiels using abap.
Please don't spread the links about the creation!
I'm only interested in the conversion of such a file.
Thanks
2010 Dec 17 7:23 AM
Hi,
you can use the FM TEXT_CONVERT_XLS_TO_SAP
*&---------------------------------------------------------------------*
*&Function module called to upload xls data into an internal table
*&---------------------------------------------------------------------*
CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'
EXPORTING
i_field_seperator = 'X'
i_line_header = 'X'
i_tab_raw_data = it_raw
i_filename = p_file_path
TABLES
i_tab_converted_data = it_upload[] "internal table having same struc as that of the flat files
EXCEPTIONS
conversion_failed = 1
OTHERS = 2.
IF it_upload[] IS INITIAL.
MESSAGE e002(zmsg).
ELSE.
ENDIF. or the FM
ALSM_EXCEL_TO_INTERNAL_TABLE
FORM get_filddata .
file = 'C:\Documents and Settings\maheswari.chegu\Desktop\Materialtype.XLS'.
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = file
i_begin_col = '1'
i_begin_row = '1'
i_end_col = '5'
i_end_row = '6000'
TABLES
intern = xcel
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
LOOP AT xcel.
CASE xcel-col.
WHEN '0001'.
itab-fld1 = xcel-value.
WHEN '0002'.
itab-fld2 = xcel-value.
WHEN '0003'.
itab-fld3 = xcel-value.
WHEN '0004'.
itab-fld4 = xcel-value.
WHEN '0005'.
itab-fld5 = xcel-value.
ENDCASE.
AT END OF row.
APPEND itab.
CLEAR itab.
ENDAT.
ENDLOOP.
ENDFORM. " GET_FILDDATA
2010 Dec 17 7:50 AM
Hello Wolfgang Bauer ,
If your excel contains more than 255 Character you can Use OLE to read the spread sheet .
hear is a standard FM to read excel to read Excel using OLE
KCD_EXCEL_OLE_TO_INT_CONVERT ( this function module reads upto 32 Character in a cell you can copy it to zee and modify the length )
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |