Skip to Content
author's profile photo Former Member
Former Member

SAP Office Integration for Word Template


I got a problem that I want to fill (not create!) a word template with a custom report. This means I have a prepared Word template which already exists. I placed some fields there just like the address etc. that should be filled dynamically by SAP values. I was looking for SAP office integration that can maybe handle this, but I did not find any coding snippet that could help. All the snippets I found were for creating a new word file which I do not need. I "just" want to have 3 things.

(1) Use/ Upload a custom Word template with fields in it.

(2) Use this template in a custom report and fill the fields from the report.

(3) Save the filled template in SAP or workspace

Any hints for this?


Add comment
10|10000 characters needed characters exceeded

3 Answers

  • Posted on Aug 11, 2015 at 09:33 AM

    Hi Michael,

    Through OLE programming you can display the information in MS Word.

    Please find below link, where i have display the selected table information in MS Word with some customization like color etc.

    Hope it can help you with your requirement.




    info.jpg (41.0 kB)
    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 11, 2015 at 12:29 PM

    Did you try ZWWW? It's not standard but very good module to create reports in word and excel.

    Add comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 11, 2015 at 12:59 PM

    Similar to XLSX, DOCX is an open source Microsoft Word document. Which means that, you will be able to use XML, to play around with the DOCX document.

    I would suggest you to do the following steps.

    1. Create a simple Word document and type in some words.
    2. From MS Word, save the document as a docx file.2015-08-11 08_52_12-.jpg
    3. Change the extension of the document to .zip
    4. Unzip the file
    5. Look at the XML files created within the unzipped folder and locate the file /word/document.xml within the folder.
    6. Use notepad edit the words you had typed in earlier, in XML file
    7. Zip it back
    8. Then change the extension of the zip file to docx
    9. Now open the file with MS Word and you should see the changes in the document.

    This should give you an idea on how to create your document template. You may load that document to mime repository and retrieve that in your program. You can use CL_ABAP_ZIP to perform zip/unzip within SAP. You can use XML classes in SAP to edit the XML values.



    Add comment
    10|10000 characters needed characters exceeded