Skip to Content

Open Microsoft Office document in SAP using OPC


if my previous post

i wrote a short description about Open XML standard.

Open XML let us the possibility to read , write and manipulate Open XML (OOXML)  documents.

sounds confusing?

let’s explain this.

we want to read Microsoft Word .docx extension into SAP , upload the file and then do some actions on this file.

in the old days we had .doc extension file that was uploaded into SAP and we had no possibility to manipulate the file.

we could only use Office Integration methods or OLE methods

and we had to open Word application to use it.

now , with OOXML we have a lot of opportunities.

Open XML files are really ZIP files and not Binary files as the legacy .doc or .xls extensions are.

we can see here examples of OPC extensions 


let’s have an example.

we will create a new Microsoft Word document.


the document contains a header with a logo and some text.

save it as scnExample.docx file.

now, let’s change the file extension to .zip.


now we have file.

we will unzip the file

and we got a zip directory contains subdirectories and files.


this is the structure of the Open Packaging Conventions (OPC) which is a container-file technology.

this is a combination of xml and non xml files that together create an Open XML document.

now , you can understand what’s the main difference between legacy and Open XML files.

Open XML let us the freedom to handle the documents as we need on any platform we need.

this is a huge advantage over the old methods that used macros and so on.

from here we will upload the file using any method of file uploading into SAP server,

( local file or Read dataset method ).

the file will be inserted into a Zip object in ABAP

and then we could manipulate and handle every part of the ZIP object.

think about in as a puzzle or a Lego.

you break it into pieces ( called parts in  OPC )

handle the pieces you need

and then collect all the pieces into one ZIP object.

and more to come…

Ronen Almog

You must be Logged on to comment or reply to a post.
    • Hi Alok Kumar.

      thank you.

      Open  XML is a wide area and  and i try to give here

      some concepts and examples of combine OOXML with SAP.

      of course there will be more blogs regarding these topics.

      Ronen Almog

    • Hi Yossi.

      there are many usings for Open XML in every organization.

      note that Open XML is also includes Excel and Powerpoint.

      it can be used for Interactive forms,

      print forms, upload data from excel,

      and many more as you can imagine.

      Ronen Almog

  • Excellent article!... I am working on a solution for docx to pdf conversion in abap and have been through this code for OOXML and CL_ABAP_ZIP recently. Nice work!

    Any pointers on conversion from docx(xstring) to pdf(xstring) within abap?

    • Hi Asif.

      thank you.

      about converting docx or xlsx to pdf

      there is a service on Sharepoint

      that converts the document to pdf.

      there are also some more services int the market.

      i suggest you to look at open xml developers site

      i'm sure you will find the correct answer.

      Ronen Almog

      • Thanks for quick reply!

        I will check the website mentioned.

        I am exploring the options to convert within SAP(ABAP) using FOP or ADS.

        I figured out that we could use Sharepoint word automation service but the problem is we are only using Sharepoint as tool and it seems the conversion service ( word automation service ) is not available as "web service" out of the box.

        Any idea if it is readily available or do we need to have some development work ( webservice generation)  done on sharepoint side ?

        • You like to convert docx to pdf.

          converting it using ABAP is not impossible.

          you can use ABAP to produce and manipulate OOXML.

          there are a lot of converters in the marks for this purpose.

          the solution is rendering the document output stream

          to a specified directory where  the converter is active as a service.