Skip to Content
author's profile photo Former Member
Former Member

New Attribute for Lead Distribution

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    Posted on Jan 12, 2015 at 12:05 PM

    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



    Untitled.png (151.3 kB)
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 01, 2015 at 11:56 PM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 30, 2014 at 05:01 AM

    Hi Raju,

    The value of customer master will be available in source called info type.

    Did you check there?

    Rgds

    Hari

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.