Finally ABAP knows Excel
There are various ways of creating an Excel spreadsheet in ABAP. Some are more masochistic than others and some are certainly more lousy than others.
The most common way is to use OLE2. Take a look at the example here. It’s commonly used because until recently it was the least bad of all the alternatives. But it is still lousy because OLE2 is run alongside the SAPGui and therefore is not only slow nor does it run as a background task.
There are also some old functions such as MS_EXCEL_OLE_STANDARD_DAT which in practice also use OLE and will give the same result but with less flexibility.
Then there are some crazy approaches such as this which explicitly manages Excel XML.
And there has to be more.
But this is no longer of any interest because now there is ABAP2XLSX. ABAP2XLSX is SCN (SAP Community Network) project developed by a smart young guy called Ivan Femia. ABAP2XLSX consists of a set of classes which enable Excel files to be managed within ABAP in native XLSX format or, in other words, without having to use external components. It is simple to develop, quick to execute and can be done in background. It is also well documented, there are dozens of available examples and it is supported by an active community.
It enables you to generate technicolour spreadsheets with formulas and absolutely everything and anything. Here is just one example (ZDEMO_EXCEL1):
https://github.com/abapinho/codesnippets/blob/master/zdemo_excel1.abap
To start to use it you just have install the nugget via SAPlink which is available at the project’s page.
Thanks to Filip Dujardin for the photo.
Greetings from Abapinho.