Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
deepika_chandrasekar
Active Contributor

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.


  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 = ''
      iv_call_authority_badi   = 'X'
      iv_avoid_authorization   = ''
    IMPORTING
      et_screen_structure      = et_result_structure.

   LOOP AT et_result_structure ASSIGNING <ls_sc_structure>.
      CLEAR:,lv_role,lv_pers_resp.
      REFRESH:li_return,li_role,li_role_txt.


      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>.
      ENDIF.


*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>.
      ENDIF.

      CALL FUNCTION 'BUPA_ROLES_GET_2'
        EXPORTING
          iv_partner      = lv_pers_resp
        TABLES
          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'.
      ENDIF.


      LOOP AT li_role_txt INTO lwa_role_txt.
        CONCATENATE lv_role lwa_role_txt-rltxt  INTO lv_role SEPARATED BY ','.
      ENDLOOP.


      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>.
      ENDIF.


ENDLOOP.

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

Regards,

Deepika.

9 Comments
Labels in this area