cancel
Showing results for 
Search instead for 
Did you mean: 

how to open a word document in dynpro

Former Member
0 Kudos

Hi experts,

i am new to web dynpro, i have a problem that i need to open a word document from desktop in my screen. its not ALV or i dont have to upload the file but i have to OPEN the file..

plz help

Regards:

Parteek

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Manu,

Follow these steps:

1. Create CONTEXT with 2 attributes - UPLOAD & SHOW of type XSTRING.

2. Add a "UPLOAD" element on the layout of screen & map it with UPLOAD attribute of context.

3. Then Add a "OFFICE CONTROL" on the same screen & map it with the SHOW attribute of context..

4. Add a BUTTON for Show Document/Open Document.

5. Add 2 attrubutes in ATTRIBUTES tab of the dynpro application:

i) DOCUMENT type IF_IOS_DOCUMENT

ii) FACTORY type IF_IOS_FACTORY

6. On method of that button (SHOW)...enter the following code:

DATA : refexp TYPE REF TO cx_ios_exception.

IF wd_this->document IS INITIAL.

wd_this->factory->get_document_proxy( IMPORTING proxy = wd_this->document ).

ASSERT ID sios_demo CONDITION wd_this->document IS BOUND.

ENDIF.

wd_this->document->opendocument( ).

  • read context node

DATA:

node_file_upload TYPE REF TO if_wd_context_node,

elem_file_upload TYPE REF TO if_wd_context_element,

stru_file_upload TYPE if_second=>element_file_upload .

  • navigate from <CONTEXT> to <FILE_UPLOAD> via lead selection

node_file_upload = wd_context->get_child_node( name = if_second=>wdctx_file_upload ).

  • get element via lead selection

elem_file_upload = node_file_upload->get_element( ).

  • get all declared attributes

elem_file_upload->get_static_attributes(

IMPORTING

static_attributes = stru_file_upload ).

stru_file_upload-show = stru_file_upload-upload.

  • set all declared attributes

elem_file_upload->set_static_attributes(

EXPORTING

static_attributes = stru_file_upload ).

7. Now add the following code to the WDDOMODIFYVIEW method (default method)

DATA:

office TYPE REF TO cl_wd_view_element.

  • get the office control

office ?= view->get_element( 'OFFICE' ).

ASSERT ID sios_demo CONDITION office IS BOUND.

  • get the IOS interface

wd_this->factory ?= office->_method_handler.

ASSERT ID sios_demo CONDITION wd_this->factory IS BOUND.

8. Run the application & enter a text file of word format in the File Upload.

9. Press show button & it will display the code of that word file.

______________________________________________________________________

Plz ask any queries if you face any problem doing the above code.

& dont forget to mark Points.

Regards:

Parteek.

Edited by: Parteek Arora on Jan 23, 2008 9:05 AM

Former Member
0 Kudos

Hi Prateek,

I will not be able to give points to you, I am opening a new thread please paste the answer there.

With Regards,

Manu

kmoore007
Active Contributor
0 Kudos

Hello Parteek,

I tried your example, but I am getting syntax error for this line:

stru_file_upload TYPE if_second=>element_file_upload .

It is saying that this type is unknown.

Former Member
0 Kudos

Hi Kenneth,

I'm also getting the same error.

How did you resolve this?

Thanks

Thruna Shanmuga

Former Member
0 Kudos

thanx, i resolved it myself.

Former Member
0 Kudos

Hi Parteek,

Could you please explain the process ,in future we may get a requirement like that.

Thanks,

Raju.

Former Member
0 Kudos

Hi Prateek,

It would be great if you can share the solution. Because I have to implement same thing in my project also.

Thanks and Regards,

Manu