Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to print an MS Word Document from ABAP

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

former_member194669
Active Contributor
0 Kudos

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

2 REPLIES 2

former_member194669
Active Contributor
0 Kudos

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

0 Kudos

Many thanks

Just the job !

Hugh