Ok now that you know more about me then you should lets get down to the reason your reading this blog to begin with.
How to get an excel spread sheet into SAP.
Well it's really a simple procedure.
First you must create an internal table to hold the spread sheet.
data iexcel type table of alsmex_tabline with header line.Now then it's a simple call to function module 'ALSM_EXCEL_TO_INTERNAL_TABLE'.
Here is the exact call.
call function 'ALSM_EXCEL_TO_INTERNAL_TABLE' exporting filename = p_fname i_begin_col = 1 i_begin_row = 1 i_end_col = 8 i_end_row = 9000 tables intern = iexcel exceptions inconsistent_parameters = 1 upload_ole = 2 others = 3.The P_Fname is the actual excel Spread Sheet on your PC.
The following code is how the data gets read by ABAP.
loop at iexcel. if iexcel-col = '0001'. artab-bukrs = iexcel-value. endif. at end of row. append artab. clear artab. endat. clear iexcel. endloop.In the above example I only have one column defined and it has the Company code you would of course define as many columns as you need.
The above code snippet sets up a loop to read thru all records in the internal table. It then checks to see what column the read returned. Then at the end of column check. Add logic to check to see if the row is complete or not. If it is then in this example we will write out a internal table then get the next record.
Well that's it I think I am going to go back to complaining about the snow now.