05-13-2011 11:24 AM
HI all,
I am implementing Office integration with templates similar to example SAPRDEMO_FORM_INTERFACE.
Everything works ok, but my problem is that I want it to run in background, activated by event CREATED of BOR DOCUMENT.
Event is raised but I have problem with following code because container is not created in backgorund.
CREATE OBJECT CONTAINER
EXPORTING CONTAINER_NAME = 'CONTAINER'.
CALL METHOD CONTROL->INIT_CONTROL
EXPORTING R3_APPLICATION_NAME =
text-BAS
INPLACE_ENABLED = inplace
INPLACE_SCROLL_DOCUMENTS = 'X'
PARENT = CONTAINER
REGISTER_ON_CLOSE_EVENT = 'X'
REGISTER_ON_CUSTOM_EVENT = 'X'
NO_FLUSH = 'X'.
CALL METHOD CONTROL->GET_DOCUMENT_PROXY
EXPORTING DOCUMENT_TYPE = DOCUMENT_TYPE
REGISTER_CONTAINER = 'X'
IMPORTING DOCUMENT_PROXY = DOCUMENT
Any idea about how to create control in batch mode?
Thanks!!
Regards.
Urtzi.
05-13-2011 1:01 PM
Office Integration requires GUI connection as it uses OLE so it won't work in background.
Imagine your app server is a UNIX...
05-13-2011 1:05 PM
It is also possible using a JAVABEAN...isn't¿?
I now if it's UNIX, but it is not the case.
Any alternative?
Thanks.
REgards.
Urtzi.
05-13-2011 1:07 PM
Do you need it for Excel?
If yes, I recommend abap2xlsx - https://cw.sdn.sap.com/cw/groups/abap2xlsx
It has background capabilities.
05-16-2011 7:53 AM
05-16-2011 9:28 AM
Hi Urtzi,
As you have said yourself, the container cannot be created in the background so the program you currently have will only work in foreground, and i for one am not clear on what is that you are doing in foreground so not able to relate that to a background process.
If you could throw more light on your requirement and what exactly is that you are trying to achieve, i am sure you will get more helpful answers from the forum.
Regards,
Chen
05-16-2011 12:23 PM
I'll try to explain what I am trying to achieve,
As told before, I want to use the SOFFICEINTEGRATION to get some data from a Word document which has form fields. Like in the example report SAPRDEMO_FORM_INTERFACE where it uses the GET_DATA and SET_DATA methods of the I_OI_FORM interface.
When I run the function module in an online dialog, I get all the objects created without a problem.
But when the funcion module is triggered by the BOR Document CHANGED event,
WF_RAISE_EVENT = 'X' in the SCMG_SP_DOCUMENT element type, the function module runs in background by the WF-BATCH user and I can't get to create the control reference to later get the document proxy
CALL METHOD c_oi_container_control_creator=>get_container_control
IMPORTING
control = control.
DATA ex_document TYPE REF TO i_oi_document_proxy
CALL METHOD control->get_document_proxy
EXPORTING
document_type = document_type
register_container = 'X'
IMPORTING
document_proxy = ex_document.
CALL METHOD ex_document->open_document_from_table " here I get an error too
...
IMPORTING
error = error " CALL_NOT_FLUSHED
retcode = lt_retcode.
I debug the function module adding and infinite loop and accessing from the SM50 Tcode, so that I can see the background process.
I could get the Word document form field data if there was a BADI in the SCASE when the user saves the document, but I think that there is not such a BADI so I have tried to use the BOR Document CHANGED event which triggers the background process.
Thanks in advance.
Urtzi.