cancel
Showing results for 
Search instead for 
Did you mean: 

SC Parallel approval workflow

0 Kudos

Dear Experts,

Kindly let me know how the parallel workflow approval works in SRM7.02?

I activated the Business function for the parallel approval workflow as per SAP recommendation and also I am using the decision type 4

However, still Parallel workflow is not working(in Approval Step 1 there are 3 approves and if any one of the approver approves the cart, it goes to next Approval step 2,and this is not correct and actually if all the approver's approve the cart than only it should go to next approval step 2)

Can anyone has any idea?

Thanks,

Krishna.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

From BasicSettings Guide:

1.

Create a process schema for determining all agents who are responsible for approving the item. You must create one process level for each responsible agent or group of responsible agents, as usual. The sequence in which you include the process levels is irrelevant.

2.

Create a process schema for parallel approval. The process level on which you want to implement parallel approval must contain the following entries:

1) Responsibility Resolver Name: RR_PARALLEL_APPROVAL

2) Parameter: Name of the process schema you have created in step 1

3) Decision Type: 4 — Item-Based Decision for Partial Document

Result

Using the Responsibility Resolver Name (RR_PARALLEL_APPROVAL) and the object type (BUS2121) as filter values, the Business Add-In (BAdI) Define Agents (/SAPSRM/BD_WF_RESP_RESOLVER) can now call the BAdI implementation for parallel approval, /SAPSRM/BD_WF_SC_RR_PA. This implementation enables the parallel creation of work items for all responsible agents that you defined in the first process schema above. Therefore, by including this process schema into the superordinate process schema, the work items are sent out in parallel instead of in sequence. Note, however, that the corresponding document is locked for other users while a work item is being processed.

Example

You create a process schema with three process levels. On the first process level, the system determines the office assistant as the responsible agent, on the second level the operational purchaser, and on the third level the line manager of the requester. If you now include this process schema into a superordinate one with the values listed above under step 2, the system creates the work items for all three responsible agents in parallel and sends them out at the same time. The agents can now process the work items independently of one another.

It works, i have checked.

But i need sample code on how to implement the BADI agent determination with multiple areas for header (decision type 4) for RFx

konstantin_anikeev
Active Contributor
0 Kudos

Hi Krishna,

please read my blog posts:

For the parallel approval you may need a special BADI implementation for agent determination.

BADI should return AREA to ITEM mapping table with multiple areas for items.

For example you want to have 2 parallel approvers for shopping cart with 2 items. Resulting area mapping table should look like:

AREA1 - ITEM1

AREA1 - ITEM2

AREA2 - ITEM1

AREA2 - ITEM2

AREA1 - for approver 1

AREA2 - for approver 2

Regards

Konstantin

0 Kudos

Thanks Konstantin for the information..

Please give a sample code on how to implement the BADI agent determination with multiple areas for items.

Thanks,

Krishna.

konstantin_anikeev
Active Contributor
0 Kudos

Hi Krishna,

have you checked exmpla implementations in

?

Regards

Konstantin

0 Kudos

Hi Konstantin,

I have already saw the sample code,but my requirement is for the custom responsible resolver need to fetch the multiple approver's in Approval Step 1(Suppose Process level 100) this logic I have written and all the approver's are getting the work item parallely in their Workflow Inbox..

But here the question, if any one of the approver approves the Cart in the approval step 1(process level 100) it goes to next approval step 2(Process level 200), but it should not happend..actual requirement is if all the approver's approve the cart in Approval step 1(process level 100) then only it should go to Approval step 2(process level 200)..For that I did the same What SAP recommended as said in the first mail...

Please let me know what I need to do here to achieve that?

Thanks,

Krishna.

konstantin_anikeev
Active Contributor
0 Kudos

Hi Krischna,

according to mentioned blog posts I have changed method

ZSRM_CL_WF_RR_AGENTS_CUST->/SAPSRM/IF_EX_WF_RESP_RESOLVER~GET_AREA_TO_ITEM_MAP

as following

METHOD /sapsrm/if_ex_wf_resp_resolver~get_area_to_item_map.

  DATA lv_guid      TYPE /sapsrm/wf_area_guid.

  DATA ls_map       TYPE /sapsrm/s_bd_wf_item_to_area.

  DATA lt_item_guid TYPE /sapsrm/t_pdo_hier_guid_list.

  DATA lo_sc        TYPE REF TO /sapsrm/if_pdo_bo_sc_adv.

  FIELD-SYMBOLS: <fs_item> TYPE /sapsrm/s_pdo_hier_guid_list.

  lo_sc = /sapsrm/cl_pdo_factory_sc_adv=>get_buffered_instance( is_document-document_guid  ).

  IF lo_sc IS NOT BOUND.

    lo_sc = /sapsrm/cl_pdo_factory_sc_adv=>get_instance(

      iv_header_guid   = is_document-document_guid

      iv_mode          = /sapsrm/if_pdo_constants_gen_c=>gc_mode_display ).

  ENDIF.

  IF lo_sc IS NOT BOUND.

    EXIT.

  ENDIF.

  lo_sc->/sapsrm/if_pdo_bo_sc~get_item_list_non_deleted(

    IMPORTING

      et_item_guid = lt_item_guid

  ).

* first branch

  TRY .

      lv_guid = cl_bbp_es_enterprise=>get_person_by_username( 'MANAGER_01' )->get_primarykey( ).

    CATCH cx_bbp_es_not_a_person.    " Exception: Person Unknown

    CATCH cx_bbp_es_not_found.    " No data found

  ENDTRY.

* get mapping table

  ls_map-area_guid = /sapsrm/cl_wf_area=>/sapsrm/if_wf_area~create_instance(

    iv_area_type          =    /sapsrm/if_wf_process_c=>gc_area_type_employee

    iv_leading_object_id  =    lv_guid )->get_guid( ).

  LOOP AT lt_item_guid ASSIGNING <fs_item>.

    ls_map-item_guid = <fs_item>-guid.

    APPEND ls_map TO rt_item_to_area_map.

  ENDLOOP.

* second branch

  TRY .

      lv_guid = cl_bbp_es_enterprise=>get_person_by_username( 'MANAGER_DE' )->get_primarykey( ).

    CATCH cx_bbp_es_not_a_person.    " Exception: Person Unknown

    CATCH cx_bbp_es_not_found.    " No data found

  ENDTRY.

* get mapping table

  ls_map-area_guid = /sapsrm/cl_wf_area=>/sapsrm/if_wf_area~create_instance(

    iv_area_type          =    /sapsrm/if_wf_process_c=>gc_area_type_employee

    iv_leading_object_id  =    lv_guid )->get_guid( ).

  LOOP AT lt_item_guid ASSIGNING <fs_item>.

    ls_map-item_guid = <fs_item>-guid.

    APPEND ls_map TO rt_item_to_area_map.

  ENDLOOP.

ENDMETHOD.

Of cause this is a quick and durty example without handling of exceptions.

as a result I have got following.

After sc order

After approval by the first approver.

Regards

Konstantin

P.S. please, dont't forget to mark usefull and correct answers...