cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

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

0 Likes
View Entire Topic
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