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 a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

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.

    OLE Programming for Excel and Word



    info.jpg (41.0 kB)
    Add a 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 a 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.
    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 a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.