‎2007 Jul 31 9:14 AM
Hi Experts,
i have a user developed screen in which there is an option to approve (not a std tcode)
for which there is no event created.
i am very new to workflow ,
now how to create an event and also how to trigger the workflow
‎2007 Jul 31 9:21 AM
Hi,
You can run a ABAP report or call a transaction from the BOR's Method directly.
Check this link for more info.
http://help.sap.com/saphelp_nw2004s/helpdata/en/80/9a3cb3971c11d194c60000e82dec10/frameset.htm.
In order to trigger an event programmatically, we would use the function module SWE_EVENT_CREATE.
BUS1001006 ( Standard Material )
here is the sample code.
DATA: key LIKE sweinstcou-objkey.
key = '68." Material Number (hard-coded)
CALL FUNCTION 'SWE_EVENT_CREATE'
EXPORTING
objtype = 'BUS1001006'
objkey = key
event = 'CREATED'
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.
WRITE 'Event Triggered'.
ENDIF.
COMMIT WORK.
************************************************************************
In order to test whether the event is getting triggered or not, we can make use of Event Trace. Switch on the event trace using the transaction SWELS.
Press Switch On.
Now execute the program developed earlier. Now switch-off the event trace using the same transaction SWELS.
Now go to transaction SWEL. Here you can list out the events triggered in the particular period of time. Here is the event-trace list:
Regards
‎2007 Jul 31 9:19 AM
Hi,
CHk this links.
Very hlpful.
http://help.sap.com/saphelp_erp2005/helpdata/en/fb/135962457311d189440000e829fbbd/frameset.htm
http://help.sap.com/saphelp_erp2005/helpdata/en/c5/e4a930453d11d189430000e829fbbd/frameset.htm
Workflow
http://www.sap-img.com/workflow/sap-workflow.htm
http://help.sap.com/saphelp_47x200/helpdata/en/a5/172437130e0d09e10000009b38f839/frameset.htm
http://www.erpgenie.com/workflow/index.htm
http://www.sap-basis-abap.com/wf/sap-business-workflow.htm
http://www.insightcp.com/res_23.htm
For examples on WorkFlow...check the below link..
http://help.sap.com/saphelp_47x200/helpdata/en/3d/6a9b3c874da309e10000000a114027/frameset.htm
http://help.sap.com/printdocu/core/Print46c/en/data/pdf/PSWFL/PSWFL.pdf
http://help.sap.com/saphelp_47x200/helpdata/en/4a/dac507002f11d295340000e82dec10/frameset.htm
http://www.workflowing.com/id18.htm
http://web.mit.edu/sapr3/dev/newdevstand.html
/people/mike.pokraka/blog/2005/07/17/sap-business-workflow-faq
Rgds
Reshma
‎2007 Jul 31 9:21 AM
Hi,
You can run a ABAP report or call a transaction from the BOR's Method directly.
Check this link for more info.
http://help.sap.com/saphelp_nw2004s/helpdata/en/80/9a3cb3971c11d194c60000e82dec10/frameset.htm.
In order to trigger an event programmatically, we would use the function module SWE_EVENT_CREATE.
BUS1001006 ( Standard Material )
here is the sample code.
DATA: key LIKE sweinstcou-objkey.
key = '68." Material Number (hard-coded)
CALL FUNCTION 'SWE_EVENT_CREATE'
EXPORTING
objtype = 'BUS1001006'
objkey = key
event = 'CREATED'
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.
WRITE 'Event Triggered'.
ENDIF.
COMMIT WORK.
************************************************************************
In order to test whether the event is getting triggered or not, we can make use of Event Trace. Switch on the event trace using the transaction SWELS.
Press Switch On.
Now execute the program developed earlier. Now switch-off the event trace using the same transaction SWELS.
Now go to transaction SWEL. Here you can list out the events triggered in the particular period of time. Here is the event-trace list:
Regards
‎2007 Jul 31 9:40 AM
Hi ,
i have tried both 'SWE_EVENT_CREATE' and also SAP_WAPI_EVENT_CREATE,
let me explain the scenario,
once the enquiry is created assuming having multiple line items
i am able to trigger the wf
but
in my case i have to approve each line item ,so there is a user developed module pool pgm screen to do the same, now when this line item is approved i have to trigger the wf and then on SO is created with reference ,
i hope my question is clear this time.
Many thanks,
subramanya
‎2007 Jul 31 6:25 PM
Hi there --- actually this is really easy.
In your ABAP create the event with FM SAP_WAPI_CREATE_EVENT.
Use transaction SWE2 to define the workflow / task to start when the event is created.
Ensure in the definition of your BOR (or CLASS if using OO workflow) you've defined an EVENT. In BOR use transaction SWO1. For classes transaction SE24.
If you are using a Standard (SAP) supplied BOR but you need to add methods / events then just define a Z version and DELEGATE it to the standard SAP one. Also done in transaction SWO1.
Cheers
Jimbo
‎2007 Aug 01 5:16 AM