Skip to Content


I wrote an abstraction class to generate complex MS Word document from SAP. This class is delivered “ready to use” and cover, i hope, a large panel of usage.

Why this class ?

OLE syntax is not easy and find help is a pain. I learned all i need to know and, to never have to do it again, i have written this class.

Now to write text into word, i simply use the method “write_text” or “write_table” to write a complete table 😉

What you can actually do with the class :

  • Create document from scratch or with a template (dotx)
  • Write text with or without style (font style or paragraph style)
  • Use option bold, italic, underline, choose font, font size, font color
  • Break line, Break page, Section, section continuous
  • Write table, with or without Table style, and option to define format by cell (bold, background color…)
  • Footnote
  • Write simple header/footer
  • Choose orientation landscape/portrait
  • Add image
  • Add canvas
  • Insert table of content
  • Insert custom field
  • Change the title of the word window
  • Save document and close word

As OLE is an old method, and seem to be a little slow for big document (in particular if you have a lot of table). So this class could be used to help all people that have a problem with OLE syntax, it contain almost all solutions 😉

In the download, you will find a test program that contain the class CL_WORD and a sample of how to use it. You will find also some image and 1 template. Theses files are used by the test program, but are not necessary for the class itself.

French presentation can be found here : Faire communiquer SAP et MS WORD grâce à OLE – Quelquepart

And there is a direct download link (remember that you will need SAPLINK to install) :

Feel free to comment here 🙂

My others blogpost :

LISTCUBE replacement : a new way to display data

ZAL11 : a replacement for AL11

ZTOAD – Open SQL editor

Generate DOCX file in ABAP

ZAUTODOC : Automatic generation of technical BW documentation

To report this post you need to login first.


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

Leave a Reply