on 2007 Jul 09 8:52 PM
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 !
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).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Björn Demol
What parameters that you use?
What I did, I pass the value to following parameter:
OBJTYPE, OBJKEY, EVENT, CREATOR
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
71 | |
10 | |
8 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.