cancel
Showing results for 
Search instead for 
Did you mean: 

Agent Determination for Service Entry

Former Member
0 Kudos
190

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

Accepted Solutions (1)

Accepted Solutions (1)

keohanster
Active Contributor
0 Kudos

Hi Darlington,

You need to fill in the AC_CONTAINER structure with the value of your Service Entry sheet key. Do this in the FM test bed, and to save yourself pain in the future, save the test data. You will need to enter the element name (exactly as defined), the Tab_In (sequential index, so a 000001 should suffice) and the Element Length, as well as the element value (your 20 char Service Entry sheet number).

Hope this helps,

Sue

keohanster
Active Contributor
0 Kudos

Oh, and your Service Entry sheet should not be defined as SWC_OBJECT in this case...

Former Member
0 Kudos

Hi Susan,

Thanks for the prompt answer.

I was able to do what you told me and it works, thank you very much!

Regards

0 Kudos

Hi Darlington,

I am also facing the same problem. Could you please let me know how you have solved your problem.

Thanks in advance.

Regards

Sarvesh

Jocelyn_Dart
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Sarvesh, T

This thread was already answered some time ago.  Please open a new Discussion marked as a question.  If the thread you originally posted to has material related to your question, include a link.  Your content is attached below to make it easy for you to simply paste it into the new Discussion.  It is recommended to read the Rules of Engagement and other documents in the Getting Started link at the top right.   If you have any questions, feel free to respond to this DM (Direct Message) and I will be happy to try to assist.

Rgds,

Jocelyn (SCN moderator)

Answers (0)