01-25-2013 5:40 AM
Hi All,
I am using OLE concept to upload excel file but I am facing an error. If the excel file has no formatting, it works fine. But if the excel file is aligned to the left, then the data fethced into the internal table will be appended with hashes '#' to the right side. Hence at the time of updating the material master with this kind of data obtained from the file, it is going for a dump. Please let me know what I need to do to overcome this alignment issue.
Thanks
01-25-2013 5:43 AM
01-25-2013 5:59 AM
Above are the screenshots. The data type of the line in the internal table used to get the data from excel file is of characters 65000
01-25-2013 6:20 AM
Hi Jean,
Is there any specific reason for using OLE to upload excel data?
The FM ALSM_EXCEL_TO_INTERNAL_TABLE also uses OLE for uploading and works without any problems.
01-25-2013 6:26 AM
I am new to OLE concept. I am not sure what to do to rectify this issue. I am not using ALSM_EXCEL_TO_INTERNAL_TABLE as i have a requirement to fetch high number of records.
01-25-2013 6:34 AM
Hi Jean,
Using OLE, performance would be a problem. You can upload any amount data using this FM(you just have to write a small logic to divide the file data upload).
It may not be correct to ask this but what is the expected number of records??
01-25-2013 6:38 AM
It can go more than 65000 records. Also the excel file will have a text which can be on any length. But this FM has file of fixed length.
01-25-2013 6:45 AM
Hi Jean,
yes the FM has fixed length of 65536.
You can try using the below code for splitting the data.
data : i_beg_row type i.
Do.
i_beg_row = 2. " This tells the FM to skip the header
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_file
i_begin_col = 1
i_begin_row = i_beg_row
i_end_col = <number of columns in your excel>
i_end_row = 65536
TABLES
intern = i_data
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc NE 0.
EXIT.
ELSE.
.....you code to append data into required internal table
i_beg_row = i_beg_row + 65536.
ENDIF.
ENDDO.
01-25-2013 6:49 AM
Hi Jean,
Please check this FM .
"KCD_EXCEL_OLE_TO_INT_CONVERT"
Regard's
Smruti