Hello all,
I have created a couple of rules that each have a parameter 'Location'. Then responsibilities are assigned based on location. Location is a virtual attribute on my business object with the following logic:
GET_PROPERTY LOCATION CHANGING CONTAINER.
Data: lv_pernr type pa0001-pernr.
SELECT single pernr into lv_pernr from pa0105
where usrid = sy-uname.
SELECT werks into OBJECT-LOCATION from pa0001 where pernr = lv_pernr
and endda >= sy-datum.
ENDSELECT.
SWC_SET_ELEMENT CONTAINER 'Location' OBJECT-LOCATION.
END_PROPERTY.
My workflow has several steps and for each step I need to look at the personnel area (PA0001-WERKS) of the workflow initiator (the person who created the customer record via VD01) and determine who should receive workflow. In my test the initiator has a personnel area of ex. '1234'.
Step 1 - rule is processing normally and returning location '1234'. But when I get to Step 2 it is returning a location of '5678' which is the location of the person who processed Step 1. Since there is no agent assigned in the responsibilities tab for location '5678' workflow stops there. From the workflow log I can see in the container for that task that KNA1.location = '5678'.
Is sy-uname the correct field to look at for the initiator of workflow? I've seen several posts that suggest to use that field to lookup the wf initiator without the 'US' in front.
Thanks for your help!