Use of SAP_WAPI_WRITE_CONTAINER

Florin Wach florin.wach at gmx.net
Mon Mar 17 09:39:09 EDT 2008


Hello Greg,

I once had a similar requirement ending up with the need to update the container while processing the workitem.
It was, that a form/dynpro with a set of account assignments and various other texts had to be filled by an approver. As this took quite a long time , and the lunchtime stroke right through it, they preferred to have their work saved, because otherwise the auto-logout of the system brought them back to where they've started.

Before I've started to extract all that data from the workflow container and bring this into custom db tables leaving a reference to this in the workflow container, I tried to update the work item container before I rose the exception exit_user_cancelled.
Apparently a roll-back work performed, resetting the complete work state, and after debugging for half a day I just gave up and implemented the form via external db tables. Now I could easily update my own stuff.

Mayhaps you'll think of something similar, to get your information out of the running work item or follow the advices that Mike already gave, as I don't see a proper solution for you here.

Best wishes,
Florin


-------- Original-Nachricht --------
> Datum: Mon, 17 Mar 2008 12:56:07 -0000 (UTC)
> Von: "Mike Pokraka" <wug at workflowconnections.com>
> An: "SAP Workflow Users\' Group" <sap-wug at mit.edu>
> Betreff: Re: Use of SAP_WAPI_WRITE_CONTAINER

> I would question the reasons you cannot use binding... perhaps you could
> elaborate because I don't understand your statement about how an FM with
> importing parameters prevents a container operation and find it difficult
> to imagine a scenario where there is no simpler way to work around what
> you describe.
> 
> To me the system behaviour is correct, you should not update the container
> yourself *inside* a synchronous WF method, and I would steer well clear of
> that.
> 
> There are other workarounds such as programmed binding or making your
> method asynch but I would still think there would be better alternatives
> that will enable regular binding.
> 
> Cheers,
> Mike
> 
> 
> On Fri, March 14, 2008 6:36 pm, SAP at e-Wave wrote:
> > 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
> >
> >
> > _______________________________________________
> > SAP-WUG mailing list
> > SAP-WUG at mit.edu
> > http://mailman.mit.edu/mailman/listinfo/sap-wug
> >
> 
> 
> _______________________________________________
> SAP-WUG mailing list
> SAP-WUG at mit.edu
> http://mailman.mit.edu/mailman/listinfo/sap-wug



More information about the SAP-WUG mailing list