on 12-29-2014 8:54 AM
Hi Everyone,
I would like to distribute the lead based on customer group which has maintained in Customer Master
It is not available when I check the attribute for customer group in Lead Context.
Path to find the available attribute in Rule Distribution:
SPRO > CRM > Transactions > Settings for Leads > Rule-Based Distribution > Define Repository
Can anyone help on this to add new attribute : Customer Group
Please help me in providing values for Customer Group to the respect
XPath Expr
Fact Gathering Srvc
Attrib. Ext. Class
Regards
Raju
Hi Raju,
Please follow below step -
1. Create a copy of CL_CRM_DD_FG_LEAD as ZCL_CRM_DD_FG_LEAD_CUST
2. Change code in method -> IF_CRM_ERMS_SERVICE~EXECUTE of class- Similar as below
METHOD if_crm_erms_service~execute.
DATA: lv_act_document TYPE crmt_object_guid,
xml_chunk TYPE string,
lt_header_guid TYPE crmt_object_guid_tab,
ls_lead_h TYPE crmt_lead_h_wrk,
lt_lead_h TYPE crmt_lead_h_wrkt,
ls_partner TYPE crmt_partner_external_wrk,
lv_customer_group TYPE c LENGTH 2, " Customer Group
lt_partner TYPE crmt_partner_external_wrkt.
CALL METHOD service_manager->get_context_entry
EXPORTING
name = cl_crm_dd_con=>gc_erms_context_act_document
IMPORTING
value = lv_act_document.
IF lv_act_document IS INITIAL.
RAISE EXCEPTION TYPE cx_crm_erms_service_failed.
ENDIF.
APPEND lv_act_document TO lt_header_guid.
CALL FUNCTION 'CRM_ORDER_READ'
EXPORTING
it_header_guid = lt_header_guid
iv_mode = 'C' "DISPLAY
IMPORTING
et_lead_h = lt_lead_h
et_partner = lt_partner
EXCEPTIONS
document_not_found = 1
error_occurred = 2
document_locked = 3
no_change_authority = 4
no_display_authority = 5
no_change_allowed = 6
OTHERS = 7.
IF sy-subrc <> 0.
RAISE EXCEPTION TYPE cx_crm_erms_service_failed.
ENDIF.
CLEAR ls_partner.
LOOP AT lt_partner INTO ls_partner WHERE ref_kind = 'A'
AND partner_fct = '00000001'. "Sold-To Party
ENDLOOP.
IF ls_lead_h IS INITIAL AND ls_partner-partner_no IS INITIAL.
RAISE EXCEPTION TYPE cx_crm_erms_service_failed.
ENDIF.
CLEAR lv_customer_group.
"Get Customer Group from CRMV_BP_FRG0030
SELECT SINGLE customer_group FROM crmv_bp_frg0030 INTO lv_customer_group WHERE partner_guid = ls_partner-partner_no(16).
CONCATENATE
'<zcustomergroup><![CDATA[' lv_customer_group ']]></zcustomergroup>'
INTO xml_chunk SEPARATED BY space.
service_manager->factbase->add_snippet( xml_chunk ).
ENDMETHOD.
3. Define Fact service for new attribute refer below -
4. Define Xpath for attribute in Repository under Lead destritbution context DD_LEAD for attribute.
Hope this helps.
Regards,
Arjun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Raju,
Since the attribute is not available you need to create new attribute in the DD_LEAD context.
Once the attribute is defined you have to create Z fact gathering service with new Z class.
Assign this new Z fact gathering service into the new attribute defined in repository.
Then you can use it in rule builder for defining distribution rules.
You can take the example of below attribute and fact gathering services to create your own.
Attribute : PROCESS_TYPE
Fact Gathering Service : DD_FG_GENERAL_1O
Fact Gathering Service Class : CL_CRM_DD_FG_GENERAL_1O
xPath for the attribute : /parts/z attribute name/text()
Regards,
Naresh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Raju,
The value of customer master will be available in source called info type.
Did you check there?
Rgds
Hari
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Hari,
I think you did not understand the requirement.
I would like to add an attribute (Customer Group) in Lead Distribution Rule.
Presently there is no attribute is available for Customer group in any contexts of Rule based Distribution.
Pls check this below path :
SPRO > CRM > Transactions > Settings for Leads > Rule-Based Distribution > Define Repository
Select the Context : DD_LEAD and click on attributes...
there I want Customer Group as an attribute.
Regards
Raju
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
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.