Application Development and Automation 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: 
Read only

error openeing word documents

gautam_totekar
Active Participant
0 Likes
1,853

Hi

I am using the following code to open a document from SAP database

It works fine for MS word 2003 documents but it is not working for MS word 2007 (*.docx) documents.

it gives error DOCUMENT_TYPE_NOT_REGISTERED for call open_document method.

CALL METHOD CONTROL->GET_DOCUMENT_PROXY

EXPORTING

DOCUMENT_TYPE = 'WWI'

DOCUMENT_FORMAT = ''

IMPORTING

DOCUMENT_PROXY = PROXY

RETCODE = RETCODE.

IF RETCODE NE C_OI_ERRORS=>RET_OK.

EXIT.

ENDIF.

CALL METHOD PROXY->OPEN_DOCUMENT

EXPORTING

DOCUMENT_URL = DOC_URL

  • OPEN_INPLACE = 'X'

  • open_readonly = 'X'

  • protect_document = 'X'

IMPORTING RETCODE = RETCODE.

IF RETCODE NE C_OI_ERRORS=>RET_OK.

EXIT.

ENDIF.

1 ACCEPTED SOLUTION
Read only

former_member156446
Active Contributor
0 Likes
1,250

in MS word 2007 you have an option to always save in .doc rather than by default .docx

Hi

I am using the following code to open a document from SAP database

It works fine for MS word 2003 documents but it is not working for MS word 2007 (*.docx) documents.

it gives error DOCUMENT_TYPE_NOT_REGISTERED for call open_document method.

CALL METHOD CONTROL->GET_DOCUMENT_PROXY

EXPORTING

DOCUMENT_TYPE = 'WWI'

DOCUMENT_FORMAT = ''

IMPORTING

DOCUMENT_PROXY = PROXY

RETCODE = RETCODE.

IF RETCODE NE C_OI_ERRORS=>RET_OK.

EXIT.

ENDIF.

CALL METHOD PROXY->OPEN_DOCUMENT

EXPORTING

DOCUMENT_URL = DOC_URL

  • OPEN_INPLACE = 'X'

  • open_readonly = 'X'

  • protect_document = 'X'

IMPORTING RETCODE = RETCODE.

IF RETCODE NE C_OI_ERRORS=>RET_OK.

EXIT.

ENDIF.

6 REPLIES 6
Read only

dev_parbutteea
Active Contributor
0 Likes
1,250

Hi,

open the .docx document and save it as .doc and use it.

Regards.

Read only

0 Likes
1,250

hello Dev

I m using the above code to open a document from Document management system ie SAP database and print. the code works fine for 2003 version but it gives error if 2007 documents are printed.

Read only

former_member156446
Active Contributor
0 Likes
1,251

in MS word 2007 you have an option to always save in .doc rather than by default .docx

Read only

0 Likes
1,250

But i neeed to open and print documents uploaded in docx format.

I m using the above code to open a document from Document management system ie SAP database and print. the code works fine for 2003 version but it gives error if 2007 documents are printed.

Read only

0 Likes
1,250

try the code as aRs suggested in :

Read only

Sm1tje
Active Contributor
0 Likes
1,250

try this:

Go to transaction smw0, press table ICON at top right, next press execute button.

Next screen via menu Settings->maintain mime types.

Here you can maintain all sorts of document types.