WAIT for Event - held in container/variable

Florin Wach florin.wach at gmx.net
Fri Apr 3 03:19:29 EDT 2009


Hi Wayne,

if you think one step outside the box, it's going to be fairly easy:

- Create an additional event to your business object and name it "CloseProcess". Make this available in your workflow pattern through system wide delegation or whatever is appropriate here.
- Create a wait step - regardless of what you hold in your container-element ... let's name it "WaitEvent" for the moment - and wait for event Object.CloseProcess
- For each other event that the business object offers (e.g. .Released .Rejected .Finalized .Completed ...) create a type-linkage in the event coupling as following:
* Enter a check-function module Z_CHECK_EVENT_OF_WORKFLOW
* Enter a receiver-function module Z_CREATE_EVT_CLOSE_PROCESS

The algorithm for the two function modules is roughly the following:

Z_CHECK_....

- Read instance linkages for Object.CloseProcess with the instance value passed from the import parameter (e.g. class method CL_SWF_EVT_EVENT_MANAGER=>select_linkages
- Determine the top-Workflow of the event-item (through the API SAP_WAPI_GET_HEADER that provides the SWR_WIHDR structure, field WI_CHKWI
- Read the workflow container from there through SAP_WAPI_READ_CONTAINER
- Select the element WaitEvent
- Compare the content of WaitEvent against the import parameter EVENT
- If that comparison is true, you have got an event for a workflow, who's "waiting" for. In this case, let the check pass, in all other cases raise an event in order to stop the receiver function module to process

Z_CREATE_EVT...

This function module blindly takes the object instance and raises the event CloseProcess for it.

SAP_WAPI_CREATE_EVENT
  Object_Type = OBJTYPE
  Object_key  = OBJKEY
  Event       = 'CLOSEPROCESS'


Given this roughly pattern you should be able to work out the details, if you can familiarize with that proposed solution.


With the very best wishes,
Florin


-------- Original-Nachricht --------
> Datum: Fri, 3 Apr 2009 11:04:51 +1100
> Von: "Hanrahan, Wayne" <WHanrahan at powercor.com.au>
> An: sap-wug at mit.edu
> Betreff: WAIT for Event - held in container/variable

> Hi all,
>  I am trying to wait for an event that is held in a variable/container.
> So I read the name of the terminating event from a custom table, and try
> to wait for it to occur. If it does, the workflow should shut down.
>  The problem: when creating the wait event, I have to select from the
> dropdown list only...I cannot specify a container which contains the
> name of the event dynamically.
>  Anyone know how to handle this? Thanks,
> Wayne Hanrahan.
> Powercor Australia.
> **********************************************************************
> CitiPower Pty and Powercor Australia Ltd. This email and any file
> attachments are confidential and intended solely for the use of the
> individual or entity to whom they are addressed. If you have received
> this email in error please tell us immediately by return email and
> delete the document.
> **********************************************************************



More information about the SAP-WUG mailing list