cancel
Showing results for 
Search instead for 
Did you mean: 

SIOS wordprocessing application method savedocument() doesn't save

Former Member
0 Kudos

SIOS package containing MS office word application doesn't save the word document to the MIME repository. It is saved temporary to the memory and user doesnt find changes made to the document after reopen.

Give Code :

wd_this->document->if_ios_document~savedocument( errorinformation = error_savedocument_stru ).

Can any one please help me find an answer on the Save function of the package. Your help is greatly appreciated.

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Surya,

Probably you already have seen my reply in the other Thread. Just for the sake of the readers to this thread. once again pasting it.

Can you please explain What is not working ? is that you change the content and the content is not getting reflected on save to the repository?.

1.Can you verify using the mime browser , that the name is exactly same.

2.See in debug mode that the content is filled

3.See if you get any exception on calling the Put method. It give you several exceptions

PARAMETER_MISSING Parameter missing or is initial

ERROR_OCCURED Unspecified Error Occurred

CANCELLED Activity Terminated

PERMISSION_FAILURE Missing Authorization

DATA_INCONSISTENCY Internal Data Inconsistency

NEW_LOIO_ALREADY_EXISTS Specified GUId for new LOIO already assigned

IS_FOLDER Specified URL is a folder

i suspect that it raise you data_inconsistency exception. So use try catch block around your code.

Former Member
0 Kudos

Bhaskaran,

Please check the response below.

Can you please explain What is not working ? is that you change the content and the content is not getting reflected on save to the repository?. Yes, the change is not getting saved to the repository. Here is the complete Code from the program for wdModify .

METHOD onactiononclick_save .

DATA refexp TYPE REF TO cx_ios_exception.

DATA: msgid TYPE syst-msgid,

msgnr TYPE syst-msgno,

msgty TYPE syst-msgty.

  • get message manager

DATA: l_current_controller TYPE REF TO if_wd_controller,

l_message_manager TYPE REF TO if_wd_message_manager.

TRY.

  • document is set through datasource!

DATA error_savedocument TYPE REF TO if_wd_context_element.

DATA error_savedocument_stru TYPE wdr_ext_attribute_pointer.

error_savedocument = wd_context->get_lead_selection( ).

error_savedocument_stru-attribute_name = 'error_savedocument'.

error_savedocument_stru-element = error_savedocument.

wd_this->document->if_ios_document~savedocument( errorinformation = error_savedocument_stru ).

*****

DATA: o_mr_api TYPE REF TO if_mr_api,

content TYPE xstring,

url TYPE string.

url = '/SAP/BC/WebDynpro/SAP/Z_WORDPROCESSING/Note for Case ID_00000101.doc'.

wd_context->get_attribute( EXPORTING name = `DATAS`

IMPORTING value = content ).

IF o_mr_api IS INITIAL.

o_mr_api = cl_mime_repository_api=>if_mr_api~get_api( ).

ENDIF.

o_mr_api->put(

EXPORTING

i_url = url

i_content = content

).

*****

CATCH cx_ios_document INTO refexp.

CATCH cx_ios_communicationwrapper INTO refexp.

CATCH cx_ios_factory INTO refexp.

CATCH cx_ios_environment INTO refexp.

CATCH cx_ios_exception INTO refexp.

ENDTRY.

IF refexp IS NOT INITIAL.

refexp->get_message( IMPORTING

mtype = msgty

number = msgnr

mid = msgid ).

l_current_controller ?= wd_this->wd_get_api( ).

CALL METHOD l_current_controller->get_message_manager

RECEIVING

message_manager = l_message_manager.

  • report message

CALL METHOD l_message_manager->report_t100_message

EXPORTING

msgid = msgid

msgno = msgnr

msgty = msgty.

ENDIF.

ENDMETHOD.

1.Can you verify using the mime browser , that the name is exactly same. Verified , its same.

2.See in debug mode that the content is filled debug mode Content reflect the same bites.

3.See if you get any exception on calling the Put method. It give you several exceptions No exception

PARAMETER_MISSING Parameter missing or is initial

ERROR_OCCURED Unspecified Error Occurred

CANCELLED Activity Terminated

PERMISSION_FAILURE Missing Authorization

DATA_INCONSISTENCY Internal Data Inconsistency

NEW_LOIO_ALREADY_EXISTS Specified GUId for new LOIO already assigned

IS_FOLDER Specified URL is a folder

i suspect that it raise you data_inconsistency exception. So use try catch block around your code.

Can you please provide me any correction, if need to the above code or the code that will save the change made to the word document by the user to save it to the MIME repository.

Former Member
0 Kudos

Hi,

Can you clarify what you mean by the bytes are same ? with respect to what ?.

Can you also confirm that the get method is working ?

Meantime can you also do a little test give different name to the document by changing the URL like .../Test.doc.

If this is working and the content is not same as you have in the original then we have to look for a solution to empty ICM cache which is suppose to be invalidate after the Change of the document.

Former Member
0 Kudos

Bhaskar,

Can you clarify what you mean by the bytes are same ? with respect to what ?.

Bytes Content (XSTRING) during intial getContent() is equal after the saveDocument() is called with the value extracted from the below code .

wd_context->get_attribute( EXPORTING name = `DATAS`

IMPORTING value = content ).

Can you also confirm that the get method is working ? Yes, it is working as it retrive the same file , i am providing in the URL.

Meantime can you also do a little test give different name to the document by changing the URL like .../Test.doc. Changing file to some other like "Test.doc" , result in error as the file is not in the MIME repository , which is true.

If this is working and the content is not same as you have in the original then we have to look for a solution to empty ICM cache which is suppose to be invalidate after the Change of the document.

I went through various thread and haven't find an answer as why its not saving the doc to the MIME repository after the PUT method is called.

Let me know, if you want me to send you the code of WDMODIFY . For Action_SAVE , code is already in the thread.

Former Member
0 Kudos

>

>

> Bytes Content (XSTRING) during intial getContent() is equal after the saveDocument() is called with the value extracted from the below code .

>

> wd_context->get_attribute( EXPORTING name = `DATAS`

> IMPORTING value = content ).

The content before and after is same (bytes ) , this is some what troubling. How do we know that updated content is send back ?,I cant access my system now to test it.

Probably what you can do is to paste a much smaller or bigger content and see the bytes are indeed different. If it is still same then we have to look into save method with magnifier glass.

Former Member
0 Kudos

No change in the bytes by increasing the document content. Save Button save the content in the buffer , but doesn't save to the repository.

Let me know, what next can we plan to debug.

Former Member
0 Kudos

Bhaskar,

Please let me know, if there is any solution you would like to pass on to me. Your help is really appreciated.

Thanks

Former Member
0 Kudos

Hallo Surya,

I have done a small test, it is working perfectly for me.

I get the document from mime repository. Coding is done in Modify method,

I have inserted a picture in my document. Press save, on_action save method handler, i called the put method. Nothing special.

Everything works fine.



method wddomodifyview.
data:
    refexp                             type ref to cx_ios_exception,
    co_error_info_getfields_stru       type wdr_ext_attribute_pointer,
    office                             type ref to cl_wd_view_element,
    mime_repository                    type ref to if_mr_api,
    content                            type xstring,
    url                                type string,
    lr_component                       type ref to if_wd_component,
    lr_component_info                  type ref to if_wd_rr_component,
    ls_comp_name                       type string.

  lr_component ?= wd_comp_controller->wd_get_api( ).
  lr_component_info = lr_component->get_component_info( ).
  ls_comp_name = lr_component_info->get_name( ).

  if first_time = abap_true.

    call method cl_wdr_utilities=>get_mime_path
      exporting
        i_component_name = ls_comp_name
        i_mime_source    = 'WDJ2WDA.doc'
*      i_is_rtl         = ABAP_FALSE
      receiving
        r_mime_path      = url
        .
    wd_this->url = url.
    mime_repository = cl_mime_repository_api=>get_api( ).

    wd_this->MIME_REPOSITORY = mime_repository.

    call method mime_repository->get
      exporting
        i_url     = url
      importing
        e_content = content.

    wd_context->set_attribute( name = 'DATAS' value = content ).


* get the office control
    office ?= view->get_element( 'GENERIC_OFFICE' ).
    wd_this->factory ?= office->_method_handler.

    try.
        wd_this->factory->get_wordprocessing_proxy(
           importing proxy = wd_this->document  ).

* open the document
        wd_this->document->if_ios_document~opendocument( ).
* Run the macro
        wd_this->document->if_ios_applicationproperties~runmacro( exporting name = 'VerdanaType'
                                                              errorinformation = co_error_info_getfields_stru ).


      catch cx_ios_document into refexp.
      catch cx_ios_communicationwrapper into refexp.
      catch cx_ios_factory into refexp.
      catch cx_ios_environment into refexp.
      catch cx_ios_exception into refexp.
    endtry.

  endif.
endmethod.

method ONACTIONONEVENTSAVE .

     DATA lo_el_context TYPE REF TO if_wd_context_element.
     DATA ls_context TYPE wd_this->element_context.
     DATA lv_datas TYPE wd_this->element_context-datas.

*    get element via lead selection
     lo_el_context = wd_context->get_element( ).
*    @TODO handle not set lead selection
     IF lo_el_context IS INITIAL.
     ENDIF.

*    get single attribute
     lo_el_context->get_attribute(
       EXPORTING
         name =  `DATAS`
       IMPORTING
         value = lv_datas ).



    wd_this->mime_repository->put(
      exporting
        i_url     = wd_this->url
        i_content = lv_datas ).

endmethod.

Just for quick testing i have defined a URL,repository_api as view attributes.

You can also ignore the part dealing with Macro.

Answers (0)