cancel
Showing results for 
Search instead for 
Did you mean: 

Agents determination using function module in Rule

Former Member
0 Kudos

HI All,

I need to use SAP standard rule 75700139 in my fucntion module for determininig user id and based on user id for task user details are fetched.

When the rule is executed from PFAC values are entered and a key is generated wirh fetches required agents.

But i want to use function modulwe in rule directly.

PArameters are -

TABLES

ACTOR_TAB STRUCTURE SWHACTOR

AC_CONTAINER STRUCTURE SWCONT

Can anybody guide how function module can be directly used and what and how values are to be filled in these parameters.

Thanks.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

You say that you want to use a standard rule inside your function module. You can simply call function module RH_RESOLVE_RESPONSIBILITIES and pass the rule number along with the needed parameters and it will execute that rule for you. Keep in mind that this function module only works if the rule uses "responsbilities." If the rule itself uses a function module, then you can call the function module directly. The AC_CONTAINER internal table is similar to a name-value pair. Look inside function module USMD5_CREQUEST_ROLE_DET which is called from within the rule you need. Instead of the macro swc_get_element, just use swc_set_element to insert values into the internal table. Make sure you add the statement "INCLUDE <cntain>." at the beginning like that function module does. The other internal table ACTOR_TAB is a simple internal table in which the first field is an object type: O for org unit, US for user, P for personnel number, etc. The second field is the object key; so if the type is US then the key is the user ID you want to assign as an agent and if the type is O then the key is the org unit number you want to assign as an agent.

Eddie_Morris
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Sanj,

If you want to see the data passed into your function at runtime then set a breakpoint in your function and in the same session open PFAC and test the rule with the Simulate button. Execution should stop at the breakpoint and you can see the data held in the parameters. If it does not stop at the breakpoint then create an SAP shortcut on your desktop with:

Type: System Command

Command: /h

When you simulate the ruleyou get the popupand enter the test data. Now drag the shortcut over the 'Continue' button and now you are in de mode.Now just set a breakint in your function and it will stop there and you can check the data.

Regards,

Eddie

vimalv
Active Participant
0 Kudos

Hello Sanj,

ACTOR_TAB will be the table returned from the Function Module. It will contain the Agents determined from the Rule.

AC_CONTAINER is the Container from your Workflow/task.

It should contain entries for elements CHANGE_REQUEST, APPSTEP, SINGLE_PROC and AGENT_FILTER.

AGENT_FILTER is optional.

You can execute the FM in SE37 Test mode and fill the values and test.

Hope this helps.

Former Member
0 Kudos

CHANGE_REQUEST is not a normal value. Its key generated through F4 help of PFAC while simulation.

Key generated for req 257 is BUS2250 000000000257000000 .

Kindly guide how this key could be obtained.