Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Selecting Possible Agents in Workflow

former_member404244
Active Contributor
0 Likes
1,367

Hi all,

Please solve this problem in workflow. I have a set of possible agents for a Manager to whome he should be able to forward his workflow items. This is maintained in customized table. I want to dynamically fetch these agents for the manager so that he should only be able to forward the work item to certain people (whom he is configured in the Z table).

Please tell how to achieve this run time determination of forwarding agents.

Thanks

Nagraj

Hi all,

Please solve this problem in workflow. I have a set of possible agents for a Manager to whome he should be able to forward his workflow items. This is maintained in customized table. I want to dynamically fetch these agents for the manager so that he should only be able to forward the work item to certain people (whom he is configured in the Z table).

Please tell how to achieve this run time determination of forwarding agents.

Thanks

Nagraj

3 REPLIES 3
Read only

Former Member
0 Likes
936

You can do this by creating your own rule and linking it to the task container.You can use the SAP FM RH_GET_ACTORS to get all the possibleagents and copy and modify it to suit it as per your conditions.

Read only

0 Likes
936

You can have a look at this function developed by me for dynamic determination of agents.rules can be created using transaction PFAC.

FUNCTION Z_FIND_SUPERIOR.

*"----


""Local interface:

*" TABLES

*" ACTOR_TAB STRUCTURE SWHACTOR

*" AC_CONTAINER STRUCTURE SWCONT

*" EXCEPTIONS

*" NOBODY_FOUND

*"----


INCLUDE <CNTN01>.

TYPES : BEGIN OF TY_USERS.

INCLUDE STRUCTURE ZUSERS.

TYPES : END OF TY_USERS.

DATA : ORG_AGENT LIKE WFSYST-AGENT,

LT_HOLDERS TYPE STANDARD TABLE OF SWHACTOR,

LWA_HOLDERS TYPE SWHACTOR,

LT_USERS TYPE STANDARD TABLE OF TY_USERS,

LWA_USERS TYPE TY_USERS,

V_LEN TYPE I,

V_BNAME LIKE ZUSERS-BNAME,

NUM_LINES TYPE I.

*Read values assigned to the rule criteria

SWC_GET_ELEMENT AC_CONTAINER 'ORG_AGENT' ORG_AGENT.

*Get the length

CLEAR: V_LEN,V_BNAME.

V_LEN = STRLEN( ORG_AGENT ).

V_BNAME = ORG_AGENT+2(V_LEN).

*Get the superior

SELECT SINGLE * FROM ZUSERS INTO CORRESPONDING FIELDS OF LWA_USERS

WHERE BNAME = V_BNAME.

IF NOT LWA_USERS IS INITIAL.

REFRESH LT_HOLDERS[].

LWA_HOLDERS-OTYPE = 'US'.

LWA_HOLDERS-OBJID = LWA_USERS-ZSUPERIOR.

APPEND LWA_HOLDERS TO LT_HOLDERS.

APPEND LINES OF LT_HOLDERS TO ACTOR_TAB.

ENDIF.

DESCRIBE TABLE ACTOR_TAB LINES NUM_LINES.

IF NUM_LINES IS INITIAL.

RAISE NOBODY_FOUND.

ENDIF.

ENDFUNCTION.

Read only

anversha_s
Active Contributor
0 Likes
936

hi chk thsi.

a sample

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

data : lt_act_container type standard table of swcont,

lt_actor_tab type standard table of swhactor,

l_act_role type hrobjec_14.

  • READ ACTORS

call function 'RH_GET_ACTORS'

exporting

act_object = l_act_role

  • ACT_TASK =

  • ACT_WI_ID =

  • ACT_PLVAR =

  • SEARCH_DATE = SY-DATUM

  • ACTOR_CONTAINER_OO =

tables

actor_container = lt_act_container

  • EXCLUDED_AGENTS =

actor_tab = lt_actor_tab "will be cleared

  • ERROR_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 <> 0

and lt_actor_tab2[] is initial.

raise nobody_found.

endif.

rgds

anver

if helped amrk points