cancel
Showing results for 
Search instead for 
Did you mean: 

BUS2012 (PO) swe_event_create - container

Former Member
0 Kudos
1,193

Hi All,

I'm looking for a way to trigger a workflow from ABAP code. Apparently, the FM swe_event_create will do this. But when I try it by onli giving the object-key with (ebeln), I receive an error saying that there are parameters of the container missing.

I wonder how I can give these values to the container. I tried to search the forum and google, but the answers were a bit complicated and unclear. Can anyone help me on this ?

thanks !

Accepted Solutions (1)

Accepted Solutions (1)

KjetilKilhavn
Active Contributor
0 Kudos

First I would recommend that you use SAP_WAPI_CREATE_EVENT instead of the old function module SWE_EVENT_CREATE.

If you do that, filling the event container is pretty straightforward. No need to use the macro SWC_SET_ELEMENT, because the container for SAP_WAPI_CREATE_EVENT is a simple key (element) & value list.

If you don't know which container elements to fill, check the event definition to see if it has any parameters. That should be the place to look, but if the error message comes from the workflow rather than the function module you should also check the workflow to see which container elements are required (and check how they are filled from the triggering event).

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi everyone,

thanks for the help. Each answer addes his value to my solution and general knowledge, every time I post a question here on the forum I get a bit smarter

I decided to go with the SAP_WAPI_CREATE_EVENT, apparently this is customer supported...

I had to add the releasecode to the container to let it work, my code looks like this :

***********************************code snippet***************************************

Data: lv_cont type swr_cont,

lt_cont type standard table of swr_cont.

lv_cont-element = 'releasecode'.

lv_cont-value = 'D9'. append lv_cont to lt_cont.

CALL FUNCTION 'SAP_WAPI_CREATE_EVENT'

EXPORTING

object_type = 'bus2012'

object_key = '4500004262'

event = 'releasestepcreated'

  • COMMIT_WORK = 'X'

  • EVENT_LANGUAGE = SY-LANGU

  • LANGUAGE = SY-LANGU

  • USER = SY-UNAME

  • IFS_XML_CONTAINER =

  • IMPORTING

  • RETURN_CODE =

  • EVENT_ID =

TABLES

INPUT_CONTAINER = lt_cont

  • MESSAGE_LINES =

  • MESSAGE_STRUCT =

***********************************code snippet***************************************

When I try this, the workflow is triggered fine.

Thanks again for the help, and enjoy the rest of your day !

Former Member
0 Kudos

hi ,

In this function module doe's object_key reffer Purchase order no.

If that is true then will this trigger the work flow only when the purchase order no is '4500004262' ?

Former Member
0 Kudos

No, this code is a test-code, and it will trigger the workflow for this PO number.

It means that every time this code gets executed, the first 'releaser' (D9) will get an item in his inbox.

I adapted the code, so now the object key depends on which po the user is working on.

former_member184495
Active Contributor
0 Kudos

Hi BD,

If I am not wrong, you need to pass the event parameters for your BOR.

If you go to SWUE, and try to simulate your BOR, it wont allow you to create an event, same error would occur, so you need to fill in the Event Parameter after which you can create your event, just check which all parameters are mandatory for your BOR and fill them accordingly.

I think this would solve your issue.

Aditya

Former Member
0 Kudos

Hi Björn Demol

What parameters that you use?

What I did, I pass the value to following parameter:

OBJTYPE, OBJKEY, EVENT, CREATOR