cancel
Showing results for 
Search instead for 
Did you mean: 

Event Related problem

Former Member
0 Kudos

Dear all ,

I have one work flow for BUS2089(Travel) object . This object is getting trigered for method Requestcreated . My workflow number is WS98000011 .

Now the requirment has come to start the workflow even if the travel request is changed . So in the header part I added Changed event also with requestcreated .

The problem is Even if the Travel request is created fresh . My work flow is trigerring twice once for changed and once for Request created . Other way the Approver for the Travel request is getting two workitem for same Travel request created .

I understood that I have to create the function module and assaign it in SWE2 . But i am not very much clear about what sort of code has to be written in function module . Please help me by giving sample code . There is already function module existing for check function module Please find the enclosed code .

data: v_2 type i,

V_objkey type SWEINSTCOU-OBJKEY,

V_objkey_U type SWEINSTCOU-OBJKEY,

cl TYPE mandt.

cl = sy-mandt.

IMPORT tab = V_objkey_U

FROM DATABASE indx(XY)

CLIENT cl

ID OBJKEY.

if V_objkey_U eq objkey and not V_objkey_U is initial.

delete from

DATABASE indx(XY)

CLIENT cl

ID OBJKEY.

V_objkey_U = objkey.

EXPORT tab = V_objkey_U

TO DATABASE indx(XY)

CLIENT cl

ID OBJKEY.

RAISE NO_RECTYPE.

else.

V_objkey_U = objkey.

EXPORT tab = V_objkey_U

TO DATABASE indx(XY)

CLIENT cl

ID OBJKEY.

endif.

ENDFUNCTION.

What should i modify here .

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Why dont you use the Change event as the triggering event of the Wflow.

Since Change event gets triggered with ReleaseCreated event.

Then use SAP_WAPI_WORKITEM_TO_OBJECT FM to create an attribute which you can put in SWB_COND so that a new workflow does not get triggered if already a Workflow is in progress. Inside the Workflow make use of Fork and wait for event change step.

Thanks

Arghadip

Former Member
0 Kudos

Hi

I am also facing the same problem.

Have u reolved the issue.

Kindly suggest for the same.

Regards,

Kalpesh

Former Member
0 Kudos

Hi,

Have you put a Wait Step (in this case wait for BUS2089-->Change) in a fork parrallel to the main process flow of your workflow to capture each iteration and ensure that only one workflow instance per trip exists at one time. This should solve your probelm.

Regards

Gareth

KKilhavn
Active Contributor
0 Kudos

Simple solution (but of course some testing is required): deactivate the triggering event linkage for "RequestCreated" since "Changed" is also triggered when a new travel request is created.