Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Terminating event 'Created' in ABAP OO context


I need a little help here. A lot of times I have used terminating event ‘Created’ for different BOR types – and asynchronous tasks where users are asked to create an object using call transaction from a work item.

Now I am struggling with the same in ABAP OO and have an issue:

The goal is to have a terminating event raised on a custom class  - and received by a work item if a customer is fully created, that is the general part, the company code part and the sales area part.

Raising the event is working great. I have put in a class in trx. SWEC together with a function module which set the class as object type if the condition is fulfilled.

Then in trx. SWED I have entered another function module to set the key for class together with object_por-catid = ‘CL’.

Then when a customer master record is created I can see in the event trace that the event is raised with the correct key.

No I want to receive the new object into my asynchronous dialog task. I define the event as terminating event – and in the code call transaction XD01.

When the work item is created I find a waiting event linkage in trx. SWE3 – of cause without key; this is unknown until after creating.

But after executing the workitem and raising the event the workitem does not receive the event and is therefore not completed.

Is this approach not possible in ABAP OO – or do I miss something in the class definition / coding?

The event is defined as public instance – I have not coded any event handler method.




Hello Claus,

Interesting question, unfortunately not with a simple answer.

The issue is that you are waiting for an instance event without a key. Your object raises an event with a key => No match.

If you raise the created event without a key, you won't be able to match up two near-simultaneous creations with their corresponding work items. Same thing if you wait for a static event.

So how does SAP do it with BOR events? By breaking the rules of course!

They do some hidden trickery to bypass this problem by doing an 'Export to Memory' of the work item ID, and the CREATED event raising code bypasses the usual event linking mechanisms and looks for it's creator by retrieving the memory variable. I don't have the exact spots of code in my head, but a bit of debugging should find it.

So what can you do? Given that you have full control of the class you could do something similar and maybe also create some kind of temporary key consisting of the Work Item ID and raise an event with that, or you could maybe skip the transaction concept completely and run the create GUI entirely within your WF step - maybe a custom screen gathering the initial data and then create the object via BAPI. Time to get creative!

Hope that helps,


Edit: Or you could do the quick and dirty solution and just use the BOR events for the step and instantiate the class during the binding back to WF...

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question