cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

N no of approvers at each process level - BADI for agent determination

Former Member
0 Kudos
489

Hi,

We are on SRM 7.1.

I need expert inputs on the below scenario for shopping cart approval:

We ahve no of conditions/levels of approval which needs to be cehcekd based on teh data in the shopping cart and accordingly fetch the approvers for each level.

I have created the different process levels in the process level config for the process schema.However now for each of the rpocess level,we can have multiple appprovers who need t approve the docuemnt/cart at the header level= and these approvers are determined at runtime.

Each of these approvers should get a seperate work item(the work item will jhave all items in the cart as it is header level approval).

E.g. PROCESS LEVEL 1--.>no of apprvers are 4,so the work item should go to appr 1.After he approves,it should go to appr 2 and so on till the appr4.

After the cart is completely approved by appr 4 of process level1,then cart should goto approver/approvers of prcoess level 2.

Can anyone explain me which BADI I should implement to fetch the aprovers and assign the FILTER AGENT for that BADI implementation to the process level config?

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

laurent_burtaire
Active Contributor
0 Kudos

Hello,

Use Enhancement spot /SAPSRM/BD_WF_PROCESS for BAdI definition /SAPSRM/BD_WF_PROCESS_CONFIG.

Regards.

Laurent burtaire.

Former Member
0 Kudos

Thanks Laurent for the response.

I need to know some more information as to what data needs to be passed to the method CREATE_PROCESS_LEVEL_CONFIG of the badi /SAPSRM/BD_WF_PROCESS_CONFIG.

I have defined my process sceham and process levesl as follows:

PRCOESS SCHEMA

process level 1 -->based on diff product catgeories in the cart,fetch the different approvers.For each of these approvers,a seperate work item is to be created.

Prcoess level 2-->Auto approval.

Depending on the number of different approvers found in PROCESS LEVEL 1,I need to repeat the same process level but with different approvers.i.e. assume there are 3 different approvers found based on the 3 different product categories in the cart,a seperate work item needs to be created for each of the approvers.

Considering this,what speciic information needs to be passed in the structure CS_PROCESS_LEVEL which will create 3 seperate work items in a sequence?

Pls advise.

Former Member
0 Kudos

Hi,

I donot understand why you are implmenting Process level Badi for Prod.Category approval, there might be different pro.categories in a SC, if you implement process level for prod.category then how will determine the level of sequential. The best future in PCW wf is item level approval, which will create workitem based on different type of prod'category. this is so simple. just follow the logic in sample badi /SAPSRM/BD_WF_AGENTS_SC in /SAPSRM/BD_WF_SC_RR_PGRP implementation.

Saravanan

Former Member
0 Kudos

As mentioned earlier,if my SC has 3 different (specific)product categories,I have 3 different approvers maintained in a z table who have to approve sequentially(one after the other) as part of the first process level.

If I implement the BADI /SAPSRM/BD_WF_RESP_RESOLVER to determine the approvers based on the product catgeory data in teh cart,the work item goes to all of them at the same time within the same process level.

In SRM 5.0,when we used in ACW,we increased the "approval index" so that the a seperate work item was created and approvers were able to approve sequentially.

I need to do the same in PCW now.The only way to increase the APPROVAL INDEX is to implement the Process level Badi rt???

Thats why i'm confused now that how will a seperate work item be created for each different approvers?

Also my workflow is at the header level so all work items(complete document) will go to each of the approvers to approve.

Pls help.

Former Member
0 Kudos

Hi,

Ok, Since you have statically defined the approers then you can simply implement the /SAPSRM/BD_WF_PROCESS_CONFIG to increase the approval index. from PCW , the process_levle_guid is basically index. Refer badi /SAPSRM/BD_WF_PROCESS_SC to understand how the levels of approvers determine dynamically.

Saravanan

Former Member
0 Kudos

Thanks Saravanan.

Your inputs are very helpful.

I just wanted to clarify 1 thing....the no of approvers are not known until runtime...as the no of approvers dpeend on the no of DIFFERENT specific(Z) catgeroies in the cart.

Considering this.when implementing the BADI /SAPSRM/BD_WF_PROCESS_CONFIG ,I have to simply repeat the same process level(with a diferent GUID so that a different work item/approval level is created) right???

However I dont understand,how does PCW determine which approver is at which level???The approvers are determined in BADI implmn /SAPSRM/BD_WF_RESP_RESOLVER only once right??I mean I wnat to see something like,

PROCESS LEVEL 1(as defined in config)>apprl level 1/work item1>appr 1

>appr level 2/work item2> appr 2

>appr level 3/work item3>appr 3

Pls advise.

Former Member
0 Kudos

Hi,

BADI /SAPSRM/BD_WF_PROCESS_CONFIG will trigger before you start adding line item into the document. BADI /SAPSRM/BD_WF_PROCESS_CONFIG create a process level GUID and will be the imported parameter of the /SAPSRM/BD_WF_RESP_RESOLVER.

Saravanan

Former Member
0 Kudos

Thanks Saravanan!!!

Just one clarifictaion....So i need to create a different process level GUID for each different work item based on the number of different product catgoeries,,....But what information do I need to pass as to which approver is at which level i.e. the approver sequence?

Former Member
0 Kudos

Hi,

you cant you implement item level approval for product category instead process level for each approver? because implementing item level approval for product category is so simple and easy to develop and that is an advantage of PCW.

Saravanan

Former Member
0 Kudos

So you mean that only for "product catgeory" approval or process level,I change the document type to "ITEM APPROVAL"?

But my problem is that even thoigh there are unique approvers based on the product catgeory data,the whole shopping cart(with all items even the ones for which the approver might not be responsbile) has to go to all unique approvers.

But when approving,they will select the radiobutton only for their responsible item(product catgeory) which is a bit wired but thats how business wants it!

Former Member
0 Kudos

Hi,

I dont understand what you are trying to explain,

But when approving,they will select the radiobutton only for their responsible item(product catgeory) which is a bit wired but thats how business wants it!

Let us say for example. you have a SC for four line items.

1 . Pro.Cat01

2 . Pro.Cat02

3 . Pro.Cat01

4 . Pro.Cat02

The approver for Pro.Cat01 will only approve the line 1 and 3 and reject the line 2 and 4?

Saravanan

Former Member
0 Kudos

Let me xplain....say the approver for PRODCAT01 is the first approver in the Approver hierarchy...As the approval workflow is at thea header level(decision type is FOR ENTIRE DOCUMENT),ther approver will see all items of the cart in his work item with radio buttons APPROVE and REJECT(APPROVE is by default checked).

So practically,the approver can approve/reject each individual item in the cart as he can see all items of cart but technically he is supposed to approve/reject only items for his product catgeory i.e. line 1 and 3.

Former Member
0 Kudos

Hi nmsrm,

Query you just asked is the business call if Business want approvers derived on based of Product Categories

they can do it these 2 ways-

a) Header level approval- Document will go for approval sequentially from prod cat1 to prod cat2...n and each approver approves the whole document

-By this approach leaad time will increase mutiple times. As document will go to various approvers sequentially and if the

document contains many distinct prod categories then document has to go through that many levels to create follow on doc.

b) Item Level approval- Document(items) will go for approval parallely for the approveres of respective product categories.Doc will create follow-on doc once each approver approves it, if any of the Approver rejected the cart. It will go to doc owner based on configuration

- This approach is advisable.

Implement spot - /SAPSRM/BD_WF_PROCESS for runtime process level creation and call badi implementation of Badi /SAPSRM/BD_WF_AGENTS to attach the agents. /SAPSRM/BD_WF_AGENTS has Badi /SAPSRM/BD_WF_RESP_RESOLVER, implement the above option a or b in method GET_AREA_TO_ITEM_MAP by creating the resposible area based on the product categories.

Hope answer is clear and helpful. Thanks.

Former Member
0 Kudos

Hello Ashwani Kumar,

I am in SRM 7.0, Process controlled workflow using BRF. As you explained abouve I am working for scenario A. For header level approval and approval should go to each approval sequentially based on category id. Unfortunately, I am not able to crack this as i could not understand what and how exactly I am supposed to call ? I implemented enhancement implementation of Badi process_config. I have already implemented Item_map, area_guid and get_responsible_approver in badi bd_wf_agents. I am not able call each category id as my area_type is lt_document_responsible. I have to keep that only because my decision type is type 1. Therefore, how would i be able to send approval to 2 approver in this scenario ?

Please advise. Thak you. I am attaching my code here.

item map method

  lt_document_responsible = get_document_responsible(

    iv_document_guid        = is_document-document_guid

    iv_document_type        = is_document-document_type

    ).

loop at lt_rfx_cat_map REFERENCE INTO wa_rfx_cat_map.

  CALL FUNCTION 'BBP_PD_QUOT_GETDETAIL'
   EXPORTING
     I_GUID                            = is_document-document_guid
   TABLES
     E_ITEM                            = efm_item
           .

  loop at efm_item REFERENCE INTO lr_efm_item.
  wa_cate-category_id =  lr_efm_item->category_id.
  append wa_cate to it_cate.
  ENDLOOP.

  ENDLOOP.

* Create responsibility area
  lo_area = /sapsrm/cl_wf_area=>/sapsrm/if_wf_area~create_instance(
    iv_area_type         = 'ZCL_WF_AREA_QTE_CATEGORY' "'/SAPSRM/CL_WF_AREA_MANAGER' "'ZCL_WF_AREA_RFQ_CEO' "/sapsrm/if_wf_process_c=>gc_area_type_manager
    iv_leading_object_id =  lt_document_responsible
    ).

* All items are assigned to a single area
  ls_area_to_item_map-area_guid = lo_area->get_guid( ).

  zgc_qte_cat_guid1 =  is_document-document_guid. "uncomment later 12.06.12
  export zgc_qte_cat_guid1 from zgc_qte_cat_guid1 to memory id 'zgc_qte_cat_guid1' . "uncomment later 12.04.12

  cat_id1 = wa_cate-category_id.
  export wa_cate-category_id from wa_cate-category_id to MEMORY ID 'wa_cate-category_id1'.
* Return responsibility area GUID ... w/o item assignment (nil GUID)
  ls_area_to_item_map-item_guid = /sapsrm/if_wf_process_c=>gc_nil_guid.
  APPEND ls_area_to_item_map TO rt_item_to_area_map.

get_responsible_approver

   DATA : IT_CATMAN TYPE STANDARD TABLE OF ty_mngr,
         wa_catman type ty_mngr.

  FIELD-SYMBOLS: <ls_agent_id> TYPE /sapsrm/s_wf_approver.

  ASSERT ID /sapsrm/wf_core CONDITION ( NOT ls_actor_id IS INITIAL ). "added by 528434

  import wa_cate-category_id = cat_id1 from MEMORY ID 'wa_cate-category_id1'.
  import ZGC_QTE_CAT_GUID1  = ZGC_QTE_CAT_GUID1  from  memory id 'ZGC_QTE_CAT_GUID1' .

   refresh : IT_CATMAN[].
  refresh : rt_approver[].

*  select zmngr from zpoc_mngr APPENDING table it_catman
*    where ZDESIGNATION ne 'CEO'. "'MANAGER902'.

SELECT zcategory_id zchanged_by
FROM zpoc_approval
APPENDING TABLE it_catman
WHERE zcategory_id = cat_id1 and zchanged_by ne agent.

  LOOP AT it_catman INTO wa_catman.

    ls_approver-approver_ot = /sapsrm/if_wf_process_c=>gc_otype_user. "/sapsrm/if_pdo_userattr_c=>gc_orgtype_user ."/sapsrm/if_wf_process_c=>gc_otype_user.
    ls_approver-approver_id = wa_catman-manager.
    APPEND ls_approver TO rt_approver.
  ENDLOOP.

  if rt_approver[] is INITIAL.

    ls_approver-approver_ot = /sapsrm/if_wf_process_c=>gc_otype_user. "/sapsrm/if_pdo_userattr_c=>gc_orgtype_user ."/sapsrm/if_wf_process_c=>gc_otype_user.
    ls_approver-approver_id = '528434'.
    APPEND ls_approver TO rt_approver.

Answers (0)