cancel
Showing results for 
Search instead for 
Did you mean: 

How to chnage work flow initiator

arpita_churi3
Active Participant
0 Kudos

Dear All,

   I have an workflow which triggers on creation/ change of contract agreement tcode - ME31K or ME32K. Work flow is working fine. I am using class local class methods to get approvers etc.

I have created custom container I_LV_INITIATOR inside work flow.

Whenever user is changing the contract through ME32K , value of container I_LV_INITIATOR is filled with

user id of person who has created the contract .

But the requirement is if purchase document category (EKKO-BSTYP) = 'K' then I want this container I_LV_INITIATOR

to be filled with user id of person who has changed the contract not with the one who has created the contract. and If I manually test the work flow from SWUS , value of container I_LV_INITIATOR is filled with user id of person who is manually processing the work flow.

Kindly help or give any suggestion f we could achieve this in enhancement or exits.

Thanks,

Arpita

Accepted Solutions (1)

Accepted Solutions (1)

pokrakam
Active Contributor
0 Kudos

I queried this with OSS a while back and apparently it's "by design", POs and Contracts will always show the PO creator as initiator for any changes.

They came close to admitting it was a stupid design, but it's been like this for too long and too many customers have made provision for it so SAP won't change it.

So the answer as per this thread is to determine who last changed it at the beginning of the WF.

Regards,

Mike

Answers (2)

Answers (2)

sbl
Active Contributor
0 Kudos

Hi All,

I will also add that I am avoiding putting the workflow initiator as agent or as a base to find my agent.

The reason is simply that if the workflow administrator has for one reason or another to restart the workflow then the workflow initiator will be the administrator and this could lead to error.

So as a recommandation always calculate (via an expression) the agent and do not take the easy way of using this variable.

Best regards

Stephane

PS: I would be happy if you share your view with me on this subject

Rushikesh_Yeole
Contributor
0 Kudos

HI,

Can you share binding for container element I_LV_INITIATOR.

arpita_churi3
Active Participant
0 Kudos

In side workflow, There is following binding..

From workflow to step :

&_WF_INITIATOR&  to &IV_WF_INITIATOR&

there is no reverse binding. I am not able to find out how and where to do reverse binding so that value of IV_WF_INITIATOR.

Rushikesh_Yeole
Contributor
0 Kudos

I will suggest, Please select USER and pass the container element

arpita_churi3
Active Participant
0 Kudos

Thanks for reply.

I have sy-uname but how to check this condition of EKPO-BSTYP = 'K'.

I need to pass sy-uname as initiator only when EKPO-BSTYP ='K' not for any other values.

For other value of BSTYP , it should be creator of workflow.

Thanks,

Arpita

Rushikesh_Yeole
Contributor
0 Kudos

HI,

Please ignore previous reply.

Please create a attribute which will determine either creator or change id as per desired condition.

in Expression, select that container element/Attribute.

If still not working, please share screenshot.

arpita_churi3
Active Participant
0 Kudos

I am using standard business object so I am not able to create custom attribute. Do I need to use custom business object?

My local class has attributes but I am not able to pass it to workflow/task container because

I am calling all  methods inside constructor In background task.

arpita_churi3
Active Participant
0 Kudos

Hi..

I have created Z business object for BUS2014. and created attribute as created by.

and I am using the same to trigger the workflow . and I have changed binding from workflow to step using this attribute created by.

but workflow is not triggering now.

what additional settings I need to do in SWEC or any where else.

Please someone guide me.

Thanks,

Arpita

Rushikesh_Yeole
Contributor
0 Kudos

HI,

in SWO1, Header: Customizing tab, you need to delegate to custom object. No need to change SWEC or SWETYPCV settings.

former_member185167
Active Contributor
0 Kudos

Hello,

Put your workflow back to the way it was before, so that it's working.

If you can't check the value of EKPO-BSTYP directly in the workflow then add an attribute to ZBUS2014 that returns the userid of the user who last changed the contract. Make sure you delegate BUS2014 to ZBUS2014 - after that you do not reference ZBUS2014 anywhere (only BUS2014). Then in the workflow just pass that attribute to IV_WF_INITIATOR.


regards

Rick

arpita_churi3
Active Participant
0 Kudos

Thanks Rick...

I have put back my business object from Z to BUS2014.

Now I am getting following error when I am trying to test workflow from SWUS as follow:

Import container contains errors (are any obligatory elements missing?)

Message no. SWF_RUN594

I have checked all binding. it is fine. and the same workflow is working in Sandbox.

Could you please help?

Thanks.

arpita_churi3
Active Participant
0 Kudos

thanks.

my workflow is triggering now, I missed one mandatory parameter.

But now issue is how to change the workflow container element I_LV_INITIATOR.

former_member185167
Active Contributor
0 Kudos

If you can't check the value of EKPO-BSTYP directly in the workflow then add an attribute to ZBUS2014 that returns the userid of the user who last changed the contract. Make sure you delegate BUS2014 to ZBUS2014 - after that you do not reference ZBUS2014 anywhere (only BUS2014). Then in the workflow just pass that attribute to IV_WF_INITIATOR.