cancel
Showing results for 
Search instead for 
Did you mean: 

passing sc guid to get_responsible_approvers method in BRF

Former Member
0 Kudos

Hello experts,

We are into SRM 7.0 in process controlled workflow using BRF. In one scenario, I want to pass SC guid / document guid to the method GET_RESPONSIBLE_APPROVERS. Or in other words what should I do if i want to call SC guid in GET_RESPONSIBLE_APPROVERS. How would I do that ? Please guide.

Thank you.

Best regards.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Experts,

Any inputs/suggestions ?
Please share your experience.

Best regards.
 

robin_janke
Contributor
0 Kudos

Hi,

you have implemented badi /SAPSRM/BD_WF_AGENTS and enhancement spot /SAPSRM/BD_WF_RESP_RESOLVER?

In here there are 2 important methods:

GET_AREA_TO_ITEM_MAP

GET_APPROVERS_BY_AREA_GUID.

Your area in this case is the shopping cart. In the get_area_to_item_map you define an area (this is a z-class with interface /SAPSRM/IF_WF_AREA) with a leading_object_id. Check out the already implemented SAP standard determinations.

in the area z-class redefine the get_responsible_approvers with the following logic:

DATA lv_leading_object TYPE /SAPSRM/WF_LEADING_OBJECT_ID.

*----------------------------------------------------------------------*
* (1) Get identifier of area's leading object
*----------------------------------------------------------------------*
   lv_leading_object = me->/sapsrm/if_wf_area~get_leading_object_id( ). "lv_leading_object is the SC GUID here

"do determination if approvers and add to the returning approvers table

Instantiate this area class in the method get_area_to_item_map with the following code:

DATA: lo_area             TYPE REF TO /sapsrm/if_wf_area.

  lo_area = /sapsrm/cl_wf_area=>/sapsrm/if_wf_area~create_instance(
           iv_area_type         = <your z-class name>
           iv_leading_object_id = <the sc guid>
           ).

Retrieve the area guid (lo_area->get_guid( ).) and add it to the returning area/item map. I thought that if you don't fill the item_guid with a value it will work on shopping cart level.

Finally the only thing to do now is retrieve the approvers using the get_approvers_by_area_guid method:

DATA lo_area TYPE REF TO /sapsrm/if_wf_area.

* Input checks
   ASSERT ID /sapsrm/wf_cfg CONDITION ( NOT is_area IS INITIAL ).
   IF is_area IS INITIAL.
     RETURN.
   ENDIF.

* 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 = <your z-class name>
     iv_area_guid = is_area-area_guid
     ).

* Return all responsible users assigned to that area
   rt_approver = lo_area->get_responsible_approvers( ).

Regards,

Robin