cancel
Showing results for 
Search instead for 
Did you mean: 

SRM 7.0 Process Controlled SC custom Approval

Former Member
0 Kudos

Hi

I now have two process schema's for cat and non cat items being dynamically slected. For non cat items I have a requirement for one level of approval to be based on Cost Center, i.e. matching the cost center of the item on the SC to the cost center attribute against various managers.

I have copied the standard BADI to a custom one and can see that this is being called ok by the appropriate process schema sequence number. I copied the standard BADI for RR_Role, so that I can pass a new authorization role to the new BADI and then only return the user with a cost center matching the one in the SC.

No code has been changed yet and all users against the new role are being returned. So far so good, I think. Now I need to modify the appropriate methods to look at the cost center.

How Should i change the GET AREA TO ITEM MAP method to instantiate the SC and find the Cost Center, but then how do I pass that cost center attribute into GET APPROVERS BY AREA GUID in order to change its code and compare CC with user CC attribute?

Any advice on this or a better way to approach this problem would be very helpful

Thanks

John

Accepted Solutions (0)

Answers (1)

Answers (1)

masa_139
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

Please copy some sample code and change the methods. You will get some idea how to get cost center information from sample code.

1. Copy /SAPSRM/CL_WF_AREA_COST_CTR to Z_CL_WF_AREA_CC

Change the method GET_RESPONSIBLE_APPROVERS

2. Copy /SAPSRM/CL_IM_WF_RR_CCTR_SC to Z_CL_IM_WF_RR_CC

Change the method GET_AREA_TO_ITEM_MAP

Change the method GET_APPROVERS_BY_AREA_GUID

Regards,

Masa

Former Member
0 Kudos

Hi Masa

Thanks for the information, where would I see /SAPSRM/CL_WF_AREA_COST being used?

Former Member
0 Kudos

Hi

I guess my question is really, I have made a copy, but how/where do I use the class & method,,

Thanks

JOhn

masa_139
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

Please look at the method GET_APPROVERS_BY_AREA_GUID of /SAPSRM/CL_IM_WF_RR_CCTR_SC.

METHOD /SAPSRM/IF_EX_WF_RESP_RESOLVER~GET_APPROVERS_BY_AREA_GUID.

----


  • This method returns all agents of an responsibility area to the

  • workflow approval task; the responsibility area (instance of class

  • /SAPSRM/CL_WF_AREA_COST_CTR) is identified by its leading object ID,

  • i.e. by the cost-center ID here.

*

  • The evaluation of responsible agents is implemented in method

  • GET_RESPONSIBLE_AGENTS of class /SAPSRM/CL_WF_AREA_COST_CTR.

  • All other methods required for instantiation of this class can

  • be inherited from the predefined super class /SAPSRM/CL_WF_AREA.

----


  • Get responsibility area reference for given area GUID

lo_area = /sapsrm/cl_wf_area=>/sapsrm/if_wf_area~get_instance_by_guid(

iv_area_type = /sapsrm/if_wf_process_c=>gc_area_type_cost_ctr <---- here !!

iv_area_guid = is_area-area_guid

).

  • Return all responsible users assigned to that area

rt_approver = lo_area->get_responsible_approvers( ).

-


Please look at iv_area_type. If you copy /SAPSRM/CL_WF_AREA_COST_CTR to Z_CL_WF_AREA_CC, I usually change the code like this.

Constants : LC_AREA_TYPE_CC type SWF_CLSNAM value 'Z_CL_WF_AREA_CC'.

  • Get responsibility area reference for given area GUID

lo_area = /sapsrm/cl_wf_area=>/sapsrm/if_wf_area~get_instance_by_guid(

iv_area_type = LC_AREA_TYPE_CC <---- here !!

iv_area_guid = is_area-area_guid

).

  • Return all responsible users assigned to that area

rt_approver = lo_area->get_responsible_approvers( ).

Regards,

Masa

Former Member
0 Kudos

Hi Masa

Thankyou for your speedy and very helpful responses.

I understand the code change now. What I am missing is how to call the changed method you just described. I followed your previous advice in post in copying a standard badi to a custom one and that all worked correctly, from the copied Badi I now have, where/how do I refer to the new 'cost center' method?

Many thanks

John

masa_139
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

I'm not clear the question. Is it about step 4?

1. Define Resolver name

Go to IMG, Define Filter Value for BADI Define Agent, Z_AAA(any name)

2. Find SAP sample implementation which is close to your logic. In this case, approved by responsible purchasing group, type 4

Go to IMG, BADI section, Define Agents

Display BADI implementation /SAPSRM/BD_WF_SC_RR_PGRP

Select Implementation Class

Copy Implementation Class /SAPSRM/CL_IM_WF_RR_PGRP_SC

3. Copy SAP sample class to your name space and enhance it to your logic.

Go to SE24 and copy /SAPSRM/CL_IM_WF_RR_PGRP_SC that you found at step 2 to Z_BBB(any name)

Change the method GET_AREA_TO_ITEM_MAP based on your logic

Change the method GET_APPROVERS_BY_AREA_GUID based on your logic

4. Create Enhanced Implementation

Go to IMG, BADI section Define Agent, Create

Enhanced Implementation Z_CCC(any name)

Composite Enhanced Implementation (blank)

BADI Implementation Z_DDD(any name)

Implementation Class Z_BBB <- you have created at step 3

BADI Definition /SAPSRM/BD_WF_RESP_RESOLVER

5. Activate Enhanced Implementation

Set the filter value.

DOCUMENT_TYPE = BUS2121

RESP_RESOLVER_NAME = Z_AAA <- you defined at step 1

Check Runtime Behavior, Implementation is active

6. Define "Define Process Levels"

7. Test & debug

Set the breakpoint in your method GET_AREA_TO_ITEM_MAP and GET_APPROVERS_BY_AREA_GUID

Regards,

Masa

Former Member
0 Kudos

Hi,

     Have an requirmenet on Custom BAdI.

     Implement resp. resolver badi for ZRR_ORG_CFO to fetch the CFO from the SRM Organization structure. In SRM Organization Structure, SRM Administrator will maintain an Attribute “Flag. For CFO”. In this BADI Implementation read the attribute from SRM Organization Structure and check the value. If the flag set to “X” get the User ID as an approver agent.  

I have created BADI Implementation for

Enhancement Spot:

/SAPSRM/BD_WF_AGENTS

BADI Name:

/SAPSRM/BD_WF_RESP_RESOLVER

Guide on, what should i change the GET AREA TO ITEM MAP method to get Area GUID so has to get CFO attibutes??? later I can get the User from GET_APPROVERS_BY_AREA_GUID