2008 Apr 19 6:15 AM
hi experts
when I use function SWE_EVENT_CREATE to create event of a BOR, how can I initialize the attributes of BOR? now I can just initialize the key field, and pass the key field to workflow container, I want to initialize all the attributes in EVTOBJECT_
many thanks
2008 Apr 19 7:27 AM
Hi,
You can create events from application or system programs by calling one of the relevant function modules SWE_EVENT_CREATE or SAP_WAPI_CREATE_EVENT .
For the following special cases, there are other function modules, which actually use the functionality of the above function module internally:
SWE_EVENT_CREATE_IN_UPD_TASK
This function module makes it possible to create events in an update task. In contrast to the function module SWE_EVENT_CREATE , it can be called with the addition of IN UPDATE TASK .
SWE_EVENT_CREATE_FOR_UPD_TASK
The event is created in the update task. (The function module is not called with the addition of IN UPDATE TASK .)
One of the remaining FM has no code in it and the other is not used anywhere even by SAP.
If you are trying to create events, use the SAP_WAPI_CREATE_EVENT function if it is available in your SAP release.
Here is the example.
REPORT Z_TIBOR_EVENT_SAP_SW .
INCLUDE <CNTN01>. " include container macros
DATA: OBJKEY LIKE SWEINSTCOU-OBJKEY,
EVENTID LIKE SWEDUMEVID-EVTID.
DATA: EVENT_CONTAINER LIKE SWCONT OCCURS 0 WITH HEADER LINE.
PARAMETERS:
OBJTYPE LIKE SWETYPECOU-OBJTYPE DEFAULT 'BUS1001006',
MATERIAL LIKE MARA-MATNR,
EVENT LIKE SWETYPECOU-EVENT DEFAULT 'CREATED',
END_DATE LIKE SYST-DATUM DEFAULT SPACE.
OBJKEY = MATERIAL.
CALL FUNCTION 'SWE_EVENT_CREATE'
EXPORTING
OBJTYPE = OBJTYPE
OBJKEY = OBJKEY
EVENT = EVENT
CREATOR = ' '
TAKE_WORKITEM_REQUESTER = ' '
START_WITH_DELAY = ' '
START_RECFB_SYNCHRON = ' '
NO_COMMIT_FOR_QUEUE = ' '
DEBUG_FLAG = ' '
NO_LOGGING = ' '
IDENT =
IMPORTING
EVENT_ID =
TABLES
EVENT_CONTAINER =
EXCEPTIONS
OBJTYPE_NOT_FOUND = 1
OTHERS = 2
.
IF SY-SUBRC 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
else.
commit work.
ENDIF.
Regards
Kiran Sure