cancel
Showing results for 
Search instead for 
Did you mean: 

Workflow Agent Not found problem

Former Member
0 Kudos
670

Hi ,

I have to send workflow to the initiator. In the Event Container I have defined one variable as requester.

I am getting correct value in the workflow container Requester variable. Buy How do I do the agent assignment So the Requester get the workitem. I dont want to send the workitem to every body.

Please let me know

Thanks

Aman

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi ,

Can I know how the workflow is triggered ?

Regards,

Vin

Former Member
0 Kudos

Business Object ZBUS1001 (Deligate from BUS1001)

I have Created One dialog screen. After filling all the necessary data when user press the Reserver(Custom Push Button) then workflow initiated. When user press the Reserve button I am executing the following code.

objtype = 'ZBUS1001'. "PLM Material

MOVE zplm_pnr_scr-matnr TO objkey.

event = 'CreatePLMMaterial'.

REFRESH event_container.

CALL FUNCTION 'SWC_ELEMENT_SET'

EXPORTING

element = 'Attachment' Value 'X'

field = zplm_pnr_scr-attachment (Screen field)

TABLES

container = event_container

EXCEPTIONS

OTHERS = 1.

CALL FUNCTION 'SWC_ELEMENT_SET'

EXPORTING

element = 'Requester'

field = sy-uname

TABLES

container = event_container

EXCEPTIONS

OTHERS = 1.

CALL FUNCTION 'SWC_ELEMENT_SET'

EXPORTING

element = 'Material'

field = zplm_pnr_scr-matnr

TABLES

container = event_container

EXCEPTIONS

OTHERS = 1.

CALL FUNCTION 'SWE_EVENT_CREATE'

EXPORTING

objtype = objtype

objkey = objkey

event = event

TABLES

event_container = 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.

ENDIF.

COMMIT WORK.

***************

Event has three parameters

Requester

Attachment

Material

Workflow logic

If attachment = 'X'

Send the workitem to the initiator. that What I wanted to Achieve.

Please let me know if you need some extra stuff.

Thanks

Aman

ramki_maley
Active Contributor
0 Kudos

In order for your workflow to work as is, Requestor should be defined (both in WF & Report) based on structure SWHACTOR.

<b>data: requestor like SWHACTOR.

event_creator-OTYPE = 'US'.

event_creator = sy-uname</b>

You can also try passing the CREATOR parameter to the FM as below and use wf_initiator as agent.

CALL FUNCTION 'SWE_EVENT_CREATE'

EXPORTING

objtype = objtype

objkey = objkey

event = event

<b>creator = event_creator</b>

Cheers,

Ramki Maley.

Message was edited by: Ramki Maley

Former Member
0 Kudos

Thanks ,

I was not concatenating with 'US'.

It worked now. I have one more Question.

I have more than one user now. How Can I send "User decision" to all those selected user. I created one backgroup task to find out the number of users and in the workflow container I have defined multiline variable. I am getting 4 users. How can I send the user decision to all the 4 users. Please suggest me .

thanks

Aman

ramki_maley
Active Contributor
0 Kudos

Aman,

Please do award points to my previous answer if it resolved your issue.

Rather than determining the users via background task, you should create an agent determination rule (called Role upto 4.6C release) using function module (Txn PFAC). If you are on a release 6.20 or above there are utilities that can redeterminee agents for an incomplete work item. This is very useful where users' responsibilities change and/or new users are assigned.

If you want to use your workflow as is, all you have to make sure is your background task returns a multiline variable that uses the same structure as SWHACTOR, bind it to the WF container multiline element. Select Expression for agent for the decision task and assign the WF multiline element as before.

BTW, you should start a new thread for an unrelated question once the original question has been successfully resolved. This will help others finding solutions quickly when faced with a similar problem.

Cheers,

Ramki Maley.

Former Member
0 Kudos

I wanted to use the workflow as it is.

I tired to use your suggession , but now I am getting error message (TISUSERS -> multiline workflow container of type SWHACTOR)

Expression &TISUSERS& has an invalid type or reference.

Previously TISUSERS had type -> multiline workflow container of type WFSYST-INITIATOR.

And in the background task I was concatenating 'US'<userid>

In the table I was getting 4 records like that

USDHIRA (DHIRA - SAP USER)

USTAVILDAR (TAVILDAT - SAP USER)

US...

US...

the workflow was sending the Decision step to DHIRA only. I think because of first record in the table.

But I need to send the decision step to all 4 users.

And also I need to export one parameter from the function module(task container) to workflow container.

userfound type char1

and in the workflow , I need to check if userfound = 'Y' send the notification to initiator. that why I wanted to stick with second option.

I will definately award full point to you.

Please suggest.

Thanks

Aman

ramki_maley
Active Contributor
0 Kudos

Aman,

Make sure the task that gets the agents has a multiline container element (let us call it T_Agents for this example) based on either Structure field WFSYST-INITIATOR or Type SWHACTOR. Make sure Export checkbox is selected in the properties tab. The method behind the task also should use the same data reference (it does not really matter in this case because both are character fields of same length).

WF container should have a multiline conatiner element exactly like the task ((let us call it WF_Agents). Make sure both the Import & Export checkboxes are selected in the properties tab for the WF element.

In the WF, perform Task to WF binding for T_Agents to WF_Agents for the step that gets the agents.

For the decision step, select Expression for Agents and assign the WF_Agents element.

This works perfectly well for me.

I do not see any problem in exporting one more parameter for userfound. But do keep in mind what you need to address the situation when the background task does not find any agents.

I hope you are aware that you can award some points to every answer that is helpful and full points to one answer that resolved the issue. Please follow the link below.

https://www.sdn.sap.com/sdn/index.sdn?page=crp_help.htm

Cheers,

Ramki Maley.

Former Member
0 Kudos

Thanks Very much.

The only problem was that I had not check the Export parameter.

i am giving you full point buddy.

RKSK
Participant
0 Kudos

Hi Amandeep,

I was just seeing the reply posted by you i want to know he way thru which i can initiate the workflow thu my ABAP coding if yes how, from your reply i got a little idea but didn't understand how to go ahead could you please help me out.

Waiting for your reply.

Thanks and Regards,

Rachit Khanna

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

You do not have to create a special variable. use &_WF_Initiator& .

Regards,

Vin

Former Member
0 Kudos

In &_WF_Initiator& I am getting WFBATCH not my user name.

Former Member
0 Kudos

Hi,

In the control tab of the task( which you donot want to send to everyone), in the 'agents' screen, you can select workflow intiator as an expression.

Regards,

Vin

Former Member
0 Kudos

I did the same thing. In the control tab of the activity

I Defined Expression &REQUESTER& .

REQUESTER is workflow container element and getting correct value.

But still I am not getting workitem in my indox.(Because I am requester)