Use of SAP_WAPI_WRITE_CONTAINER

SAP@e-Wave sap at e-wavesolutions.com
Fri Mar 14 14:36:53 EDT 2008


Hi everyone.  I am curious if anyone else has to update a main  
workflow container whilst WITHIN a running workitem using  
SAP_WAPI_WRITE_CONTAINER in ECC 6.0

So, whilst a workflow is executing, a step in the workflow is calling  
a method of a 'z' object.  This method needs to update an element in  
the main workflow container (again, I can't pass it back via the  
swc_set_element macro for various reasons, one being that the method  
in production calls a function module that only has importing  
parameters, not exporting, etc, etc, too late to change now as we have  
thousands of existing workitems).

I have done extensive testing an analysis and am quite stumped.

You can call SAP_WAPI_WRITE_CONTAINER during the method (or, more  
specifically, from an FM called from the method), but it won't update  
the parent workflow container as it raises an exception (you can see  
it in the step history for that workitem in the technical log): "

Call of interface SAP_WAPI_WRITE_CONTAINER within the runtime system  
not permitted" (this is message number SWF_RUN 624).

If I look in the code of the WAPI, there is a specific check:

*- function valid (allowed)
       IF lv_handle LE 0.
         lv_excp = lh_wapi->get_last_exception( ).
         return_code = 900.
         RAISE EXCEPTION lv_excp.
       ENDIF.

If I copy this function module and comment these lines out, then all  
works fine.  What's also frustrating, is that this code snippet that  
performs the check does not exist i 4.6 or 4.7, so it works there!   
For some reason in 6.0, they have prevented the use of this WAPI to be  
called during a running workitem.

Now yes, I can write an ABAP that runs and updates the container  
external to the workflow, but I need this to happen real time.

I have even tried putting a wrapper FM around it and calling it in the  
update task.  It doesn't error out, but mysteriously just doesn't  
update the container.

Again, for a lot of technical reasons that I won't list, I can't just  
use standard container binding, so it's a pretty unique case.

Any help/thoughts from anyone would be greatly appreciated.

Cheers,
Greg





More information about the SAP-WUG mailing list