Skip to Content
0
Former Member
Aug 15, 2011 at 02:00 PM

Agent Determination for Service Entry

127 Views

Hi Guys,

I created a workflow based on BO BUS2901 to send approval notification to an approver and I am having an issue with the agent determination. I am using the cost centre owner from the PR associated with the PO for the service entry as the approver.

I am using the following code in the FM of the rule I created for determining the agent:

FUNCTION ZME_REL_GET_RESPONSIBLE.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  TABLES
*"      ACTOR_TAB STRUCTURE  SWHACTOR
*"      AC_CONTAINER STRUCTURE  SWCONT
*"  EXCEPTIONS
*"      NOBODY_FOUND
*"----------------------------------------------------------------------

  INCLUDE <cntain>.

  TABLES: eban, essr_rel, essr, ekpo, ebkn, csks.

  DATA: object TYPE swc_object.

  DATA: BEGIN OF essrkey,
           lblni LIKE essr-lblni,
           ebeln LIKE essr-ebeln,
        END OF essrkey.
  DATA: verak_user TYPE csks-verak_user, kostl TYPE ebkn-kostl.

  REFRESH actor_tab.
  CLEAR actor_tab.

  swc_get_element ac_container 'ServiceEntry' object.

  IF sy-subrc EQ space.

    essrkey-lblni = object-objkey(10).
    essrkey-ebeln = object-objkey+10(10).

      select * from ekpo where ebeln = essrkey-ebeln.
        select single * from ebkn where banfn = ekpo-banfn.
          kostl = ebkn-kostl.
      endselect.

    select * from csks where kostl = kostl.
      verak_user = csks-verak_user.
    endselect.
    actor_tab-otype = 'US'.
    actor_tab-objid = verak_user.
    APPEND actor_tab.

  endif.

ENDFUNCTION.

When I debug, sy-subrc = 8 at swc_get_element ac_container 'ServiceEntry' object.

What could be the problem?

Thanks

Regards