Skip to Content

Hello.

if my previous post http://scn.sap.com/community/abap/application-development/blog/2013/03/08/what-is-open-xml

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 

/wp-content/uploads/2013/04/opc1_200954.jpg

let’s have an example.

we will create a new Microsoft Word document.

/wp-content/uploads/2013/04/opc_200955.jpg

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.

/wp-content/uploads/2013/04/opc1_200954.jpg

now we have scnExample.docx.zip file.

we will unzip the file

and we got a zip directory contains subdirectories and files.

/wp-content/uploads/2013/04/opc2_200957.jpg

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


To report this post you need to login first.

13 Comments

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

    1. Ronen Almog Post author

      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

      (0) 
  1. Yossi Levi

    Ronen,

    Very intersting.  Its a really new technology,

    Can you give examples to use it in the SAP?

    Yossi Levi,

    SAP FI Analyst

    (0) 
    1. Ronen Almog Post author

      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

      (0) 
  2. asif irfan

    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?

    (0) 
    1. Ronen Almog Post author

      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

      http://openxmldeveloper.org/

      i’m sure you will find the correct answer.

      Ronen Almog

      (0) 
      1. asif irfan

        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 ?

        (0) 
        1. Ronen Almog Post author

          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.

          (0) 

Leave a Reply