cancel
Showing results for 
Search instead for 
Did you mean: 

create a dynamic process level for quotation

Former Member
0 Kudos

Hello experts,

We are in SRM 7.0, process controlled workflow using BRF working on Quotation.

For the quotation, decision type is always type 1----decision for entire document. This can't be item based decision for entire document.

We have category id based approval i the quotation.

As the decision type is decision for entire document, multiple category id approver is not working. I mean even though there are ECSC and STAT categories, the approver is only ECSC based as it is the later categry id entry in the z table.

Therefore, to send this approval sequentially to the multiple approvers based on number of category Ids, we have decided to add process level dynamically for each category id.

i know that badi /sapsrm/bd_wf_process_config needs to be implemented. I don't know what exactly I am supposed to code inside that ? I knew what i am supposed to code while bringing agents from get_responsible_approvers and call it in area_guid. Earlier I have brought agents based on category id but it was item based decision for entire document. It was easier to bring it using get_area_to_item_map. But here i am not sure what code I am supposed to write ?

Has anyone worked on this ? Please share your ideas.

Thank you.

Best reagrds.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Experts,

Any suggestions ? Please guide me on this. I have done follwing so far.

For header level approval, approval should go to each approver 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.

Best regards.