Skip to Content
    I will give realworld example by explaining it step by step.I tried to clarify the topic with more screenshots and code block as possible.This is my first blog post.Please send your comments to me and if there is any unclear point about the topic, dont hesitate to ask.     If you want to enhance a standard BT search page in CRM webclient by adding a field and not creating a custom field as AET does because you already have it but only you cannot access it in search node not like enhancement in result node with the help of BOL relationship, you should follow the steps in this blog.       Last week, the customer wanted to search activities by Planned Date. Querying it with startDate or creationDate couldnt meet her needs so I had to enhance standard BOL query BTQAct without so much effort.        I have done a lot of enhancements for search pages in CRM webClient, in those developments I chose the way by filtering data came from standard query results in custom controllers.    But at this time , i should do it in alternative way because i will add only one extra search parameter that is not so complicated relationship with Activity header and now the performance is another important matter. Let’s talk less, do much. Firstly we have to find which structure and handler class work at background. Go to SE16 and open table *CRMC_OBJ_BTIL *, find the entries BTQAct (search structure) and BTQRAct (Result Structure)  Change Attr Struct with *ZCRMST_QUERY_ACT_BTIL*   Insert *ZCL_CRM_QACT* to Handler Class    Of course we need these two objects.    SE11: Copy from *CRMST_QUERY_R_ACT_BTIL* by adding PlannedDate field to *ZCRMST_QUERY_R_ACT_BTIL*    Go to SE24 to copy from class *CL_CRM_QACT_RUN_BTIL *to *ZCL_CRM_QACT_RUN_BTIL*.     if you realize that we wrote *ZCL_CRM_QACT* but created class *ZCL_CRM_QACT_RUN_BTIL* because at the runtime it  adds suffix *RUN_BTIL* automatically so you shouldnt write full class name.       in method* GET_DYNAMIC_QUERY_RESULT *of class* **ZCL_CRM_QACT_RUN_BTIL* , replace the standards structure with new one (ZCL_CRM_QACT_RUN_BTIL).    Until now , we built the stuctures but where from do i intervene to search and result code  to replace the standard logic with our custom search functionality so  we will implement two different BADIs   first Enhancement Spot : *ES_CRM_RF_Q1O_SEARCH* TO ls_selection_parameters.       INSERT ls_selection_parameters INTO TABLE lt_selection_parameters.     ENDLOOP.   ENDLOOP.    READ TABLE lt_multivalues INTO ls_multivalues WITH KEY  fieldname = ‘PLANNED_DATE’.   DELETE lt_multivalues WHERE fieldname = ‘PLANNED_DATE’.    IF ls_multivalues IS INITIAL.      CALL FUNCTION ‘CRM_BSP_OIC_1O_SEARCH_FROM_RF’       EXPORTING         it_search_tab             = it_search_tab         iv_number                 = iv_number         it_multivalues            = lt_multivalues         iv_extern_call            = ‘X’         iv_select_for_headerlevel = ‘X’         iv_call_authority_badi    = ‘X’       IMPORTING         et_guidlist               = lt_guidlist         et_return                 = et_return.     et_guidlist = lt_guidlist.    ELSE.      DESCRIBE TABLE lt_multivalues LINES lv_count.     CALL FUNCTION ‘CRM_BSP_OIC_1O_SEARCH_FROM_RF’       EXPORTING         it_search_tab             = it_search_tab         it_multivalues            = lt_multivalues         iv_extern_call            = ‘X’         iv_select_for_headerlevel = ‘X’         iv_call_authority_badi    = ‘X’       IMPORTING         et_guidlist               = lt_guidlist         et_return                 = et_return.      lt_guid[] = lt_guidlist.      LOOP AT ls_multivalues-searchvalues INTO wa_searchvalues.        MOVE-CORRESPONDING wa_searchvalues TO wa_rtv_planned_date .       APPEND wa_rtv_planned_date TO rtv_planned_date.      ENDLOOP.       IF NOT lt_guid IS INITIAL.       SELECT header~guid         FROM crmd_orderadm_h AS header INNER JOIN crmd_link  AS link                    ON link~guid_hi = header~guid          INNER JOIN scappt ON scappt~appl_guid = link~guid_set         INTO TABLE lt_guids FOR ALL ENTRIES IN lt_guid         WHERE         header~guid = lt_guid-table_line AND         header~object_type = ‘BUS2000126′ AND         link~objtype_hi = ’05’ AND link~objtype_set = ’30’ AND          scappt~appt_type = ‘ORDERPLANNED’ AND          scappt~date_from IN rtv_planned_date.     ENDIF.      lt_guid[] = lt_guids[].     IF iv_number IS NOT  INITIAL.       lv_num = iv_number.       APPEND LINES OF lt_guid FROM 1 TO iv_number TO et_guidlist.     ELSE.       lv_num = 100.       APPEND LINES OF lt_guid FROM 1 TO lv_num  TO et_guidlist.     ENDIF.    ENDIF.  ENDMETHOD.    0.1.  second Enhancement Spot : *ES_CRM_RF_Q1O_READ* TYPE  zcrmst_query_r_act_btil.    CALL FUNCTION ‘CRM_BSP_OIC_1O_READ_FROM_RF’     EXPORTING       it_object_key            = it_object_key       iv_screen_structure_name = iv_result_structure_name       iv_refresh_headeredition = ‘X’       iv_call_authority_badi   = ‘X’       iv_avoid_authorization   = ‘X’     IMPORTING       et_screen_structure      = et_result_structure.    wet_result_structure[] = et_result_structure[].    LOOP AT wet_result_structure INTO wa_result_structure.      SELECT SINGLE scappt~date_from     FROM crmd_orderadm_h AS header INNER JOIN crmd_link  AS link                ON link~guid_hi = header~guid      INNER JOIN scappt ON scappt~appl_guid = link~guid_set     INTO wa_result_structure-planned_date     WHERE     link~objtype_hi = ’05’ AND link~objtype_set = ’30’ AND     header~guid = wa_result_structure-guid AND     scappt~appt_type = ‘ORDERPLANNED’ .      MODIFY  wet_result_structure FROM wa_result_structure.    ENDLOOP.     et_result_structure[] = wet_result_structure[] .   ENDMETHOD.  for these two BADIs , implement a filter as BTQACT =  OBJ_IL  so it shouldnt work for other BusinessTransactions like Order,Opportunity Finally , add the field from available area to visible area.
To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

  1. nikita nikita
    hi,

    thanks a lot for your blog.

    simple and  really helpful.

    request you to blog more on BOL like creating custom BOL objects.

    cheers,
    nikita.

    (0) 

Leave a Reply