Skip to Content
Author's profile photo Deepika Chandrasekar

Search Result Enhancement with custom z fields

This document is about enhancing the search result structure with custom fields and updating those custom fields while search in BADI

Step1: First we need to enhance the search result structure with custom fields

find out structure name for the search Query result relation say for BTQRSrvReq attribute structure is CRMST_QUERY_R_SRV_REQ_BTIL

Search your Result structure in GENIL_MODEL_BROWSER


Go to the structure and click on append structure option and create new append structure with your custom fields and activate the structure

say ZZPERSON_RESP_ROLE is added in the append structure


Step2:We need to create new enhancement spot for ES_CRM_RF_Q1O_READ in Tcode SE18


Give the enhancement implementation name


Give BADI Implementation name and class name


After creating implementation we need to add filter data

click on filter and click on combination to create


After this double click on OBJ_IL and add the filetr values and activate the enhancement


After everything is done click on Implementation class


Step 3: We need to do code in READ method to fill the value in custom field

Click on the read method and call standard FM CRM_BSP_OIC_1O_READ_FROM_RF to get read standard field values in the structure

and then loop the table and populate your custom field value

  FIELD-SYMBOLS:<fwa_structure> TYPE crmt_bsp_scrstrucname,
                <ls_sc_structure>     TYPE any,
                <lt_screen_structure> TYPE table,
                <itf_ref_prod_gen>    TYPE any.

      it_object_key            = it_object_key
      iv_screen_structure_name = iv_result_structure_name
      iv_refresh_headeredition = ”
      iv_call_authority_badi   = ‘X’
      iv_avoid_authorization   = ”
      et_screen_structure      = et_result_structure.

   LOOP AT et_result_structure ASSIGNING <ls_sc_structure>.

      CONCATENATE ‘<ls_sc_structure>’ ‘-GUID’ INTO lv_name.
      ASSIGN (lv_name) TO <itf_ref_prod_gen>.
      IF sy-subrc IS INITIAL.
        lv_guid = <itf_ref_prod_gen>.
        UNASSIGN <itf_ref_prod_gen>.

*person responsible role
      CONCATENATE ‘<ls_sc_structure>’ ‘-PERSON_RESP’ INTO lv_name.
      ASSIGN (lv_name) TO <itf_ref_prod_gen>.
      IF sy-subrc IS INITIAL.
        lv_pers_resp = <itf_ref_prod_gen>.
        UNASSIGN <itf_ref_prod_gen>.

          iv_partner      = lv_pers_resp
          et_partnerroles = li_role
          et_return       = li_return.

      IF li_role IS NOT INITIAL.
        SELECT * FROM tb003t INTO TABLE li_role_txt FOR ALL ENTRIES IN li_role WHERE role = li_role-partnerrole AND spras = ‘E’.

      LOOP AT li_role_txt INTO lwa_role_txt.
        CONCATENATE lv_role lwa_role_txt-rltxt  INTO lv_role SEPARATED BY ‘,’.

      REPLACE FIRST OCCURRENCE OF ‘,’ IN lv_role WITH space.
      CONCATENATE ‘<ls_sc_structure>’ ‘-ZZPERSON_RESP_ROLE’ INTO lv_name.
      ASSIGN (lv_name) TO <itf_ref_prod_gen>.
      IF sy-subrc IS INITIAL.
        <itf_ref_prod_gen> = lv_role.
        UNASSIGN <itf_ref_prod_gen>.


Step 4: Add your custom field in configuration of the required component in this case SRQM_INCIDENT_S

Step 5: Generate getter/setter methods for custom field in configuration of the required component in this case SRQM_INCIDENT_S

After this you can get the custom field value in the result where ever this query is executed



Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo kalpana l
      kalpana l

      Hi deepika,

      I need one help..i have created AET field customer appointment date and customer appointment time field i have addded in Service order screen search and resutl list screen..i have added code in BTDATES component DATE_FROM field setter method and TIME_TO field set method ..

      But while creating service order  in GUI iam not getting values..if we create in web wui we will get the values..please help here.



      Author's profile photo om prakash
      om prakash


      I have one requirement ,where i have to find the Enhancement Spot/Badis for Search Enhancement with custom z fields.


      Om Prakash

      Author's profile photo Sumeet Gehlot
      Sumeet Gehlot

      Hi Om,

      Which z fields u are referring to is it related to Accounts, One order transaction etc.

      This below is related to service request search result enhancement so here deepika has used ES_CRM_RF_Q1O_READ BADI..

      Open a seperate discussion to discuss more on this



      Author's profile photo om prakash
      om prakash

      Hi Sumeet,

      Great thanks for your prompt response,

      Actually ,I am looking for a Enhancement Spot/Badis for the following :

      For Result Relevant in Contact----

      UI Component:  BP_CONT_SEARCH

      View: BP_CONT_SEARCH/SearchResult

      Context Node: RESULT

      Added  z field to -- CRMST_CONTACT_PERSON_OBJ_BUIL .

      So, I can able to populate the  custom field .

      [New to CRM -- learning]-please help me out..

      Help,suggestion,ideas will be greatly appreciated.

      thanks and regards,

      Om Prakash.

      Author's profile photo Sumeet Gehlot
      Sumeet Gehlot

      Hi Om,

      CRM_BUPA_IL_SEARCH is the enhancement spot we used for Acc -Search Result.

      For more info.

      Create a Discussion Thread & explain what issue you are facing.

      Author's profile photo Raimundo de Oro-Pulido Albo
      Raimundo de Oro-Pulido Albo

      Thank you for sharing. Very useful.

      One comment: If you want to add an standard field included in the same table (CRMD_ORDERADM_H in this case), like 'Changed at', steps 2 & 3 are not necessary. Just append structure and add the field in BSP_WD_CMPWB.

      Author's profile photo MOHAMED ANSARI

      Hi  Deepika,

      As per your screen shot,you have shown the Dquery object in the genil_model_editor. but you shown Append Stucture for Query Result object. ????

      You can enhance the dquery stucture always.

      Is it possibile to enhance query result stucture? becasue query result will be the root object .

      Please clarify.



      Author's profile photo Former Member
      Former Member

      Hi Deepika,

      Thank you very much for your blog, I used this and successfully created search result enhancement for bringing a custom partner function partner details.


      Vivenchandar Raja

      Author's profile photo Anne Lubig
      Anne Lubig

      Hello Deepika,

      is it possible to sort and filter the column you created?