Skip to Content

OLE2Object – ABAP OLE2 Object Utility Class

As we all know, sometimes comprehensive dynamic Excel automation developments can be a little bit complicated with OLE2_OBJECT methods. You have to record a macro and find out what’s going on in VBA (Visual Basic for Applications) codes for each specific process, if you don’t know it backwards .)

Hence, about a year ago I wrote a simple utility class for mostly needed common processes (e.g. set/get values, formatting options etc.) in Excel automation. You can simply create a new Excel sheet or open an existing one and manipulate it as you want.

You can just copy and paste the code in “Source Code-Based” class builder editor of a global usual ABAP Class.

Source code on GitHub:
https://goo.gl/axI0qO
(Fork me on GitHub if you want to contribute)

Originally published at – ABAP OLE2 Object Utility Class

To report this post you need to login first.

4 Comments

You must be Logged on to comment or reply to a post.

  1. shashi kiran

    Hi Zafer,

    Thanks for the wonderful blog.

    I have copied the code and tested. It is working fine and generating an excel file in “.XLS” format. So my question is: Can we create an excel file with “.XLSX” format uisng OLE2? if so please guide me to achieve that.

    Thanks,

    Shashi

     

     

    (0) 
    1. Zafer Onbaş Post author

      Hi Shashi,

      I’m glad you like it. Sure we can create it with “XLSX” format. Actually it’s a better practise .) so I’ve just committed the change in GitHub for Excel create and open modes.

      Thanks,
      Zafer

      (0) 
  2. Paul Hardy

    I would suggest doing as Google search on ABAP2XLSX.

    Every few months someone comes up with a new way to export SAP data to Excel, but in my opinion ABAP2XLSX takes some beating.

     

    (0) 
    1. Zafer Onbaş Post author

      Hi Paul,

      I knew “ABAP2XLSX” before I wrote my own class. I think, it’s a perfect tool for advanced level apps, but so detailed for basic and ITM Excel manipulations.You should use STMS or SAPLink to install dozens of Classes, DDIC Objects etc. to your system even though you don’t need them. It’s more trouble than it’s worth if you just develop an app that I mentioned above.

      Thanks,
      Zafer

      (0) 

Leave a Reply