cancel
Showing results for 
Search instead for 
Did you mean: 

SRM 7.0 Get Current document within the method GET_APPROVERS_BY_AREA_GUID

Former Member
0 Kudos

Hello,

I am implementing de Process Controled Workflow in SRM 7.0 and i need to determine the approvers for each item of a Shopping Cart based on the current document information, for example Product Category, company and item value.

I am implementing the BADI Define Agents ( /SAPSRM/IF_EX_WF_RESP_RESOLVER ) within the GET_APPROVERS_BY_AREA_GUID method.

To achieve this i have implemented the GET_AREA_TO_ITEM_MAP method to create decision sets to group items with the same product category, altough in the GET_APPROVERS_BY_AREA_GUID method i'm not being able to get the document guid or items guid so i can use the FM to get the SC detail.

Does anyone have an ideia how can i get this information?

Any help will be apreciated and points will be awarded.

Best regards,

Diogo Henriques

Accepted Solutions (1)

Accepted Solutions (1)

masa_139
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

Please check some of BADI implementations delivered by SAP.

Go to SPRO -> SRM -> SRM Server -> Business Add-Inns -> Business Workflow -> Process-Controlled Workflow -> Define Agents.

----


  • (1) Get the Shopping Cart's item list ...

----


  • Get shopping cart instance

lo_wf_pdo_sc ?= /sapsrm/cl_wf_pdo_impl_factory=>get_instance(

iv_document_guid = is_document-document_guid

iv_document_type = is_document-document_type

iv_pdo_event_handling = abap_false

).

TRY.

lo_pdo_sc ?= lo_wf_pdo_sc->/sapsrm/if_wf_pdo~get_pdo( ).

  • the obligatory parameter IT_PARENT_GUID must be an empty table,

  • only then the complete item hierarchy is returned.

  • If the parameter IT_PARENT_GUID is not empty then only the direct children

  • of the imported parents are returned.

CALL METHOD lo_pdo_sc->/sapsrm/if_pdo_base~get_item_list

EXPORTING

it_parent_guid = lt_header_guid

IMPORTING

et_item_guid = lt_item_guid.

CATCH /sapsrm/cx_pdo_wrong_bus_type

/sapsrm/cx_pdo_pd_read_error

/sapsrm/cx_pdo_lock_failed

/sapsrm/cx_pdo_no_authorizatio

/sapsrm/cx_pdo_parameter_error

/sapsrm/cx_pdo_status_error

/sapsrm/cx_pdo_incons_user

/sapsrm/cx_pdo_error

INTO lx_pdo_ex.

RAISE EXCEPTION TYPE /sapsrm/cx_wf_error EXPORTING previous = lx_pdo_ex.

CATCH /sapsrm/cx_pdo_abort INTO lx_pdo_ex.

RAISE EXCEPTION TYPE /sapsrm/cx_wf_abort EXPORTING previous = lx_pdo_ex.

ENDTRY.

Regards,

Masa

Former Member
0 Kudos

Hello Masa,

I've looked into your example and i do not have available in the method the parameter is_document or any other that can help me refer to the document.

The parameters of this method are the Area of Responsability and the List of Approvers.

Maybe it is possible to relate the area of responsability with the shopping cart items? is there any FM or class that i can use?

Best regards,

Diogo Henriques

masa_139
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

The sample code was for method GET_AREA_TO_ITEM_MAP.

Please let us know your logic for getting area and approver. It may be implemented in the GET_AREA_TO_ITEM_MAP method.

Regards,

Masa

Former Member
0 Kudos

Hello Masa,

We have a scenario that can contemplate shopping carts with multiple items that can be approved in N-Levels by diferent agents accordingly to product category for instance.

the strategy to achieve this, is:

1- Implement the badi to determine the process levels in runtime depending on the SC value, product category, region of the world.

2 - Split the responsability of approval in each process level by product category, by creating decision sets within the GET_AREA_TO_ITEM_MAP method.

3- Determine for each decision set, who are the responsible agents by using the GET_APPROVERS_BY_AREA_GUID method.

I beleive i can only determine agents in the last method.

PS: the approval matrix is not rigid, that means that according to the region of the world the company is, the product category, and a few other characteristics, the approval process can have 1, 2, 3, N levels of decision.

Best regards,

Diogo Henriques

masa_139
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

The BADI implementation by Purchasing Group /SAPSRM/BD_WF_SC_RR_PGRP is delivered by SAP.

The last code of GET_APPROVERS_BY_AREA_GUID calls /SAPSRM/CL_WF_AREA_PURCH_GRP.

  • Return all responsible users assigned to that area

rt_approver = lo_area->get_responsible_approvers( ).

You can copy /SAPSRM/CL_WF_AREA_PURCH_GRP and exted it based on your requirements in SE24.

Regards,

Masa

Former Member
0 Kudos

Thank you Masa,

I'll look into that tip and get back to you.

Best regards,

Diogo Henriques

Answers (0)