I am trying to use ole to read excel spreadsheet into my abap program. I have downloaded a sample program which keeps crashing on me. I do not know how to resolve the issue because I do not understand the ole concept.
Can you give me a brief explanation of how this works and a sample working code if possible?
OLE is notoriously difficult to use. You need to determine the VBA commands on the Excel side, to achieve what you want to do. Once you have determined these, you can then write the ABAP to do it, using the CREATE OBJECT, CALL METHOD and SET/GET PROPERTY OF etc. keywords. The sample code provided by SAP, RSOLETT1, is very good - and it does work, provided you have your enviroment correctly set up - you might need to speak to your basis team about this.
One of the easiest ways to use OLE, is to write a VBA macro in Excel for your task, and call that from SAP.
A simpler solution might be to save your spreadsheet as a tab delimited flat file. Then you can use WS_UPLOAD function module, or READ DATASET to read the values into your program.
This was first published in July 2001