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

Start MS word, execute macro IN BACKGROUND

Former Member
0 Likes
749

Hello Colleagues,

With the upgrade to SAP 6.04, we've got the opportunity to use MS word IN a SAP GUI container to write some letters to our customers. I've been asked to create a background job to retrieve some information from the Word document via a VSB macro into an EDIFACT message.

This al works fine in the foreground (of course), but in the background the I receive an error message regarding the Control Framework that he GUI can not be activated. So the issue is the triggering of the macro, or the use of MS word, but to start MS Word in the background with the i_oi_ole_container_control.

The following code triggers the error message.


data: g_container_control                type ref to i_oi_ole_container_control.
data g_dynpro_custom_container   type ref to cl_gui_docking_container. 

  call method
    g_container_control->init_control
    exporting
      r3_application_name      = 'i.s.h.med: WordContainer'(000)
      inplace_enabled          = 'X'
      inplace_scroll_documents = 'X'
      inplace_resize_documents = 'X'
      inplace_show_toolbars    = 'X'
      parent                   = g_dynpro_custom_container
      register_on_close_event  = 'X'
      register_on_custom_event = 'X'
    importing
      retcode                  = retcode.

Does anyone has a clue how to overcome this issue?

Best regards,

Johan Ellen

Edited by: C. CareForICT on Dec 7, 2009 2:48 PM

Edited by: C. CareForICT on Dec 7, 2009 2:54 PM

Hello Colleagues,

With the upgrade to SAP 6.04, we've got the opportunity to use MS word IN a SAP GUI container to write some letters to our customers. I've been asked to create a background job to retrieve some information from the Word document via a VSB macro into an EDIFACT message.

This al works fine in the foreground (of course), but in the background the I receive an error message regarding the Control Framework that he GUI can not be activated. So the issue is the triggering of the macro, or the use of MS word, but to start MS Word in the background with the i_oi_ole_container_control.

The following code triggers the error message.


data: g_container_control                type ref to i_oi_ole_container_control.
data g_dynpro_custom_container   type ref to cl_gui_docking_container. 

  call method
    g_container_control->init_control
    exporting
      r3_application_name      = 'i.s.h.med: WordContainer'(000)
      inplace_enabled          = 'X'
      inplace_scroll_documents = 'X'
      inplace_resize_documents = 'X'
      inplace_show_toolbars    = 'X'
      parent                   = g_dynpro_custom_container
      register_on_close_event  = 'X'
      register_on_custom_event = 'X'
    importing
      retcode                  = retcode.

Does anyone has a clue how to overcome this issue?

Best regards,

Johan Ellen

Edited by: C. CareForICT on Dec 7, 2009 2:48 PM

Edited by: C. CareForICT on Dec 7, 2009 2:54 PM

2 REPLIES 2
Read only

naimesh_patel
Active Contributor
0 Likes
608

Control Framework would not work in the Background. Because in Background, system doesn't have control with the Presentation Layer and this control framework is leveraging the Presentation Layer.

So, anything which would work with the Presentation Layer would not work. You may try to create the document in XML which word can understand.

Regards,

Naimesh Patel

Read only

0 Likes
608

I'm sorry, but I don't think you understand the issue (or I don't understand your answer!!).

The word file (*.doc) is stored IN SAP. Together with i.s.h.med (part of IS-Healthcare) the functionality is introduced to use MS word and store the word file IN SAP.

When I want to create an EDIFACT message I need some information from the word document. Therefor I made a FM that retrieve the .doc file from the SAP database, start MS word, triggers a Macro and the returned content of the macro is used in the EDIFACT message. This must work in the background.

I do understand that the presentation layer doesn't work in the background, but I hoped that there is a solution available to start MS word in an invisible state, without the presentation layer, but with the ability to trigger the macro's of the .doc .

So XML is not an option, I need MS word.

Thanks,

Johan Ellen