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

How to print an MS Word Document from ABAP

Hi all

Users want me to print a word document from within an abap program.

Is this possible ?

No data is being passed to the document and it's way to complex to create in smart forms.

would something like this work ?

CREATE OBJECT WORD 'Word.Application'.

SET PROPERTY OF WORD 'Visible' = 1.

CALL METHOD OF WORD 'Open'

EXPORTING #1 = 'PATH AND FILE NAME'.

CALL METHOD OF WORD 'RUN' EXPORTING #1 = 'OPEN1'.

any help much appreciated !

Hugh

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Mar 17, 2009 at 05:40 PM

    Check this

    report  zars no standard page heading
            line-size 170
            line-count 65(4).
    include ole2incl .
    data: v_word type ole2_object ,
    v_documents type ole2_object ,
    v_newdoc type ole2_object ,
    v_actdoc type ole2_object .
    start-of-selection .
      create object v_word 'WORD.APPLICATION'.
      set property of v_word 'Visible' = '0' .
      call method of v_word 'Documents' = v_documents.
      call method of v_documents 'Open' = v_newdoc
        exporting #1 = 'c:	est.doc' .
      call method of v_word 'ActiveDocument' = v_actdoc .
      call method of v_actdoc 'PrintOut' .
      call method of v_word 'Quit' .
    end-of-selection.
      free: v_word, v_actdoc, v_documents, v_newdoc .
    

    PS : This code i found in the same forum few manths back

    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.