cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

agent determination in the second loop

Former Member
0 Likes
658

Hi all,

I have copied the WF 2100071 and I think that I have a problem with the AC Rule 2100045. I have change the rule to 'F' (agent determination: function to be executed), where I always return 3 user-id (XB03300, XB03301, XB03302).

If the first approval has been done by the user-id XB03300, I don't understand why same user can give the second approval.

The user-id XB03300 shouldn't give the second approval.

How can I exclude the user of the first approval in the following loops?

Cheers and thanks in advance

Mar

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Likes

Ideally the workflow should be updating EXCLUDEDAGENTS with the actual agents in each loop.

Is that not happening? You may have to make a copy of the workflow and change it.

Former Member
0 Likes

Hi Rick,

yes, the excludeagents should work. It is very strange, I only change the flag "Step not in workflog log" to blanc and activated the WF again. And then it works perfectly.

I suppose that something was generated wrong, I don't know, although I had activated the WF several times before getting the error I exposed in this thread.

Cheers and thanks a lot

Mar

Answers (4)

Answers (4)

anjan_paul
Active Contributor
0 Likes

Hi,

   You are using same rule in the step in LOOP.  So is there any specific contianer to find out which agent you need to  specify or excluded.   If not then same users will get the workitem.

  If you don't want to user approve twice, then you have to handle it programatically in the Function module used in rule  . you have   to pass one container element for rule using Excluded agent or index to indentify which user  should not get  workitem

SandySingh
Active Contributor
0 Likes

Hello Marcos

You can copy the rule to custom rule and add an extra container element (that stores previous agents) as importing parameter. In the rule you can filter the agents by comparing old and new agents.

You can also call the rule in the background step programatically. Pass the previous agents and filter the new agents. Then you can assign the new agents as actual agents in the decision task.


INCLUDE <swfcntn01>.

DATA: lt_actor_container TYPE REF TO if_swf_cnt_container,

      lt_actor_tab       TYPE STANDARD TABLE OF swhactor ,

      lt_messages        TYPE bapirettab .

*local structure declaration

DATA: ls_message         TYPE         bapiret2,

      ls_actor           LIKE LINE OF lt_actor_tab .

* Local variable declaration

DATA: lv_objid                 TYPE objektid,

      lv_plvar                 TYPE plvar,

      lv_vacant                TYPE xfeld.

      FREE : lt_actor_tab.

      lt_actor_container = cl_swf_cnt_factory=>create ( ).

      swf_clear_container lt_actor_container.

      swf_set_element lt_actor_container 'XXXXXX'       iv_XXX.

      swf_set_element lt_actor_container 'XXXXX'      iv_XXXX.

*call function RH_GET_ACTORS passing rule number

      CALL FUNCTION 'RH_GET_ACTORS'

EXPORTING

  act_object                = 'AC9XXXXX' <Rule no>

  search_date               = sy -datum

  ACTOR_CONTAINER_OO        = lt_actor_container

TABLES

*       actor_container           = lt_actor_container

  actor_tab                 = lt_actor_tab

EXCEPTIONS

  no_active_plvar           = 1

  no_actor_found            = 2

  exception_of_role_raised  = 3

  no_valid_agent_determined = 4

  no_container              = 5

  OTHERS                    = 6.

  IF sy- subrc EQ 0 .

*- delete initial entries

  DELETE lt_actor_tab WHERE otype IS INITIAL

  OR objid IS INITIAL .

*- sort and condense

  SORT lt_actor_tab BY otype objid.

  DELETE ADJACENT DUPLICATES FROM lt_actor_tab COMPARING otype objid .

  IF lt_actor_tab IS NOT INITIAL .

  ET_AGENTS[] = lt_actor_tab[].

  ENDIF.

  ENDIF.

Regards

Sandy

former_member201570
Active Participant
0 Likes

Hi,

First you have to test the function module of the Rule  independently  and ensure the agents ( approvers ) are getting correctly . Once it is working fine then Stimulate the Rule and it is also working according to your requirement then check in Workflow level ( binding , the condition you used for loop pass etc.)

Regards,

Shamsudheen.

Former Member
0 Likes

Hi Shamsudheen,


thanks for your answer. I already did that and I can not find why the agent of the first loop is considered in the second too.


Cheers

Mar

mohit_bansal3
SAP Mentor
SAP Mentor
0 Likes

Hi,

As per the workflow design current Agent , will give approaval only one. if the current approver, approve the work item then it will be populated for excluded agent and will not be consided for next loop pass. Loop ends when all the approver approves it.

Regards,

Mohit Bansal

Former Member
0 Likes

Hi Mohit,

thanks for your answer.

The problem is, that the agent IS considered in the next loop too.

Cheers

Mar