on 07-29-2010 1:29 PM
Hi all,
I am new to SRM workflow, we are using SAP SRM 7.0 and We have configured shopping cart process oriented workflow using process schema 3C_SC_600_001. As of now it is working fine for two levels of header level approval. we need an another level of approval but by item wise cost centre. the approvers are the cost centre owners which are in R/3 not in SRM.
Please help me out how to configure,what to configure , how to fetch item cost centre and how to fetch approvers from R/3 comparing item cost centre in detail.
Regards,
Sateesh
Hi Sateesh,
This is very simple to achieve..
How to fetch Item Cost Center:
Fetch the shopping cart header and Item details ...
CALL FUNCTION 'BBP_PD_SC_GETDETAIL'
EXPORTING
i_guid = iv_document_guid
i_with_itemdata = 'X'
IMPORTING
e_header = lwa_sc_header
TABLES
e_item = li_sc_item
e_account = li_sc_accnt
e_limit = li_sc_limit
e_status = li_status.
You will see what you need in u201Ce_accountu201D
How to fetch approver from R/3:
RFC call should be fine..
What to configure & How to Configure:
The functionality you looking for cannot be achieve by SAP delivered Schema, Event or Expressionu2026
You need to configure and develop Z stuff here..
Ref Step by Step configuration guide for more help..
http://help.sap.com/saphelp_srm70/helpdata/en/74/c0256bebb54f1c8dfb519d2908152b/frameset.htm
Thanks!!
Bharath
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi Masa,
It was very much helpful. can you please let me know in method /sapsrm/if_ex_wf_resp_resolver~get_approvers_by_area_guid of class /SAPSRM/CL_IM_WF_RR_CCTR_SC what should i implement. i mean how should i capture cost centre to pass it to RFC and after getting the approvers how should i pass them as responsible approvers.
Please help me out as i am new to SRM and these sort of workflows.
Thanks and regards.
sateesh
METHOD /SAPSRM/IF_EX_WF_RESP_RESOLVER~GET_APPROVERS_BY_AREA_GUID.
----
This method returns all agents of an responsibility area to the
workflow approval task; the responsibility area (instance of class
/SAPSRM/CL_WF_AREA_COST_CTR) is identified by its leading object ID,
i.e. by the cost-center ID here.
*
The evaluation of responsible agents is implemented in method
GET_RESPONSIBLE_AGENTS of class /SAPSRM/CL_WF_AREA_COST_CTR.
All other methods required for instantiation of this class can
be inherited from the predefined super class /SAPSRM/CL_WF_AREA.
----
DATA lo_area TYPE REF TO /sapsrm/if_wf_area.
Constants : LC_AREA_TYPE_CC type SWF_CLSNAM value 'Z_CL_WF_AREA_CC_TABLE'.
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 = LC_AREA_TYPE_CC
iv_area_guid = is_area-area_guid
).
Return all responsible users assigned to that area
rt_approver = lo_area->get_responsible_approvers( ).
ENDMETHOD.
Edited by: Masa on Jul 30, 2010 7:04 PM
METHOD /SAPSRM/IF_WF_AREA~GET_RESPONSIBLE_APPROVERS.
----
Area of responsibility corresponds to a cost center;
responsible managers of that cost center are returned as agents
----
DATA ls_costcenter_id TYPE hrsobid.
DATA ls_approver TYPE /sapsrm/s_wf_approver.
DATA : begin of ls_owner,
value type SOBID,
owner(12),
end of ls_owner.
DATA : lt_owner like standard table of ls_owner.
----
(1) Get identifier of area's leading object
----
ls_costcenter_id-otype = 'K'.
ls_costcenter_id-sobid = me->/sapsrm/if_wf_area~get_leading_object_id( ).
ASSERT ID /sapsrm/wf_core CONDITION ( NOT ls_costcenter_id IS INITIAL ).
----
(2) Return all responsible managers to that cost center
----
add validity period check later
select value owner from Z00_CC_OWNER appending table
lt_owner where acc_cat = 'CC' and value = ls_costcenter_id-sobid.
Get backend logical system <---- please implement
Remote Function call- Get CC owner <---- please implement
LOOP AT lt_owner into ls_owner.
ls_approver-approver_ot = /sapsrm/if_wf_process_c=>gc_otype_user.
ls_approver-approver_id = ls_owner-owner.
APPEND ls_approver TO rt_approver.
ENDLOOP.
ENDMETHOD.
hi masa, thanks a lot.
here is my final code.
----
Resolve the result actor_tab to users.
DATA : l_owner type char12.
CALL FUNCTION 'Z_OBJECT_INFO_GET_COSTCENTER' DESTINATION 'IDSCLNT210'
EXPORTING
COSTCENTER_NUMBER = ls_costcenter_id-SOBID
CONTROLLING_AREA = '1100'
DATE = sy-datum
IMPORTING
COSTCENTER_INFO =
COSTCENTER_OWNER = l_owner
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2
.
CALL FUNCTION 'RH_STRUC_GET'
EXPORTING
act_otype = ls_costcenter_id-otype
act_objid = ls_costcenter_id-sobid
act_wegid = gv_eval_path
act_int_flag = 'X'
TABLES
result_tab = lt_agent
EXCEPTIONS
no_plvar_found = 1
no_entry_found = 0
OTHERS = 2.
ASSERT ID /sapsrm/wf_core CONDITION sy-subrc EQ 0.
IF sy-subrc NE 0.
RETURN.
ENDIF.
LOOP AT lt_agent REFERENCE INTO lr_agent WHERE otype = /sapsrm/if_wf_process_c=>gc_otype_user.
ls_approver-approver_ot = 'US'. "lr_agent->otype.
ls_approver-approver_id = l_owner. " lr_agent->objid.
APPEND ls_approver TO rt_approver.
ENDLOOP.
IN method /SAPSRM/IF_EX_WF_RESP_RESOLVER~GET_AREA_TO_ITEM_MAP
SORT lt_account BY distr_perc.
LOOP AT lt_account REFERENCE INTO lr_account.
CONCATENATE lr_account->cost_ctr
lr_account->co_area
INTO ls_item_to_cctr_map-cost_ctr_id.
ls_item_to_cctr_map-cost_ctr_id = lr_account->cost_ctr.
APPEND ls_item_to_cctr_map TO lt_item_to_cctr_map.
ENDLOOP.
CATCH /sapsrm/cx_pdo_abort INTO lx_pdo_ex.
RAISE EXCEPTION TYPE /sapsrm/cx_wf_abort EXPORTING previous = lx_pdo_ex.
ENDTRY.
ENDLOOP.
----
(3) Return document item - responsibility area assignment
----
The item list is sorted according to the characteristics of an
responsibility area (i.e. according to the cost center ID here)
SORT lt_item_to_cctr_map BY cost_ctr_id.
LOOP AT lt_item_to_cctr_map REFERENCE INTO lr_item_to_cctr_map.
AT NEW cost_ctr_id.
For each cost center a new responsibility area is created, which is
an instance of class /SAPSRM/CL_WF_AREA_COST_CTR; this instance can
later be retrieved by the cost center ID ("leading object ID") in
method GET_APPROVERS_BY_AREA_GUID to return the list of responsible
agents of this cost center
Constants : LC_AREA_TYPE_CC type SWF_CLSNAM value 'Z_CL_WF_AREA_COST_CTR'.
IF check_costcenter_assignment( lr_item_to_cctr_map->cost_ctr_id ) = 'X'.
lo_area = /sapsrm/cl_wf_area=>/sapsrm/if_wf_area~create_instance(
iv_area_type = LC_AREA_TYPE_CC " /sapsrm/if_wf_process_c=>gc_area_type_cost_ctr
iv_leading_object_id = lr_item_to_cctr_map->cost_ctr_id
).
ls_area_to_item_map-area_guid = lo_area->get_guid( ).
ELSE.
ls_area_to_item_map-area_guid = /sapsrm/if_wf_process_c=>gc_nil_guid.
ENDIF.
ENDAT.
IF NOT ls_area_to_item_map-area_guid EQ /sapsrm/if_wf_process_c=>gc_nil_guid.
ls_area_to_item_map-item_guid = lr_item_to_cctr_map->item_guid.
APPEND ls_area_to_item_map TO rt_item_to_area_map.
ENDIF.
ENDLOOP.
in method /SAPSRM/IF_EX_WF_RESP_RESOLVER~GET_APPROVERS_BY_AREA_GUID
Constants : LC_AREA_TYPE_CC type SWF_CLSNAM value 'Z_CL_WF_AREA_COST_CTR'.
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 = /sapsrm/if_wf_process_c=>gc_area_type_cost_ctr
iv_area_type = LC_AREA_TYPE_CC
iv_area_guid = is_area-area_guid
).
Return all responsible users assigned to that area
rt_approver = lo_area->get_responsible_approvers( ).
it is working fine..please look at the code an d let me know if you find some faulty code.
once again thanks a lot.
regards,
sateesh.
Hi,
How about using Remote Function Call from SRM to ERP to get approvers.
Regards,
Masa
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.