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: 

DOCUMENT_TYPE_NOT_REGISTERED error

gautam_totekar
Active Participant
0 Kudos

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

Ramneek
Advisor
Advisor
0 Kudos

Hello Gautam,

I am not sure if you have a requirement to use a document proxy. If not then you could use the following code and it will render the .docx document in the container.

Hope this helps.

Thank you,

Ramneek

CREATE OBJECT container

EXPORTING

container_name = custom_container.

CALL METHOD c_oi_container_control_creator=>get_document_viewer

IMPORTING

viewer = document_viewer.

CALL METHOD document_viewer->init_viewer

EXPORTING

parent = container.

CALL METHOD document_viewer->view_document_from_url

EXPORTING

document_url = doc_url.

1 REPLY 1

Ramneek
Advisor
Advisor
0 Kudos

Hello Gautam,

I am not sure if you have a requirement to use a document proxy. If not then you could use the following code and it will render the .docx document in the container.

Hope this helps.

Thank you,

Ramneek

CREATE OBJECT container

EXPORTING

container_name = custom_container.

CALL METHOD c_oi_container_control_creator=>get_document_viewer

IMPORTING

viewer = document_viewer.

CALL METHOD document_viewer->init_viewer

EXPORTING

parent = container.

CALL METHOD document_viewer->view_document_from_url

EXPORTING

document_url = doc_url.