Skip to Content
avatar image
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 comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    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 comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    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 comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    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 comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      I am sorry Raju. Did not understand correctly.

      I have not worked on this scenario and hence would request other SCN members to pitch in to help you.

      Rgds

      Hari