Thursday, November 1, 2018

Search and value help for custom fields - tx. SM_CRM - Seach: Change documents

As I am still newbie the Solution manager seems to me still as miracle black box. There are nice techniques like e.g. dynamic mapping of searched database table fields and class methods within table CRMC_REPDY.

Version


My task was to make alive search of already made custom fields. The thing is the version of Solution manager heavily matters here. In my case it was Solman 7.1.

I found two precious tutorials to follow:


  1. Basically all the stuff should work according to perfect manual of Peter Weigel.
    http://www.hybrid-eichhörnchen.de/business-transaction-search-enhancement/
  2. Second valuable article is describing how to work with web UI written by Robyn Osby
    https://blogs.sap.com/2015/02/06/how-to-update-smcrm-search-criteria-to-report-based-on-the-value-of-a-custom-field/

The corner stone is appending of custom fields to structures CRMST_QUERY_SRV_REQ_BTIL and CRMST_QUERY_R_SRV_REQ_BTIL. It has made the search abilities alive. Then there is a need to play with web UI and create a new Custom configuration area.

Unfortunately value help within list-box on search page for custom field did not work at all. I have touched all the ATX_* tables like e.g. ATX_RUN_FIELDDEF according to Peter's manual. Still no gain. I have spend bunch of time by creating various custom search helps and their proper associations, by playing with data dictionary. Nothing led to the goal in this Solman version.

Custom value help


I had already working search with custom fields on search and result page, but still no possible value lists.

Finally I found bellow steps to make it work. I had fixed value list within domain of data dictionary.


  • Open Changed document search page
  • Locate the custom field - select it to have the focus on it
  • Press key F2, you should see something like:








  • Take here Application component name: AIC_CMCD_S 
  • Run tx. BSP_WD_CMPWB and use the component name click display
  • Within the tree locate the proper View - see the picture. 







The view leads you to a main implementation class CL_AIC_CMCD_SEARCHQUERYVI_IMPL. Now it becomes easy. Just enhance the class in a standard way with new methods for each custom field. The naming convention is what matters here to correctly trigger the method for field on the web page. So each value help method must start with prefix GET_V_ + field key name. In my case GET_V_ZZFLD00000K.

Content of the method could look like:

METHOD GET_V_ZZFLD00000K .

  DATAlt_domain_entries TYPE STANDARD TABLE OF dd07v,
        lt_sel_table TYPE crmt_thtmlb_search_ddlb_nvp,
        ls_sel_table LIKE LINE OF lt_sel_table.

  FIELD-SYMBOLS <fs_domain> TYPE dd07v.

  CALL FUNCTION 'DD_DOMVALUES_GET'
  EXPORTING
    domname        'CRM_BOOLEAN' " any dictionary domain... 
    TEXT           'X'
    langu          sy-langu
  TABLES
    dd07v_tab      lt_domain_entries
  EXCEPTIONS
    wrong_textflag 1
    OTHERS         2.

  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ELSE.

    LOOP AT lt_domain_entries ASSIGNING <fs_domain>.
      ls_sel_table-KEY <fs_domain>-domvalue_l.
      ls_sel_table-VALUE <fs_domain>-ddtext.
      APPEND ls_sel_table TO lt_sel_table.
      CLEAR ls_sel_table.
    ENDLOOP.

    cs_result-ddlb_options lt_sel_table.
  ENDIF.

ENDMETHOD.



Have fun with Solman ;-)


Other sources:
https://stackoverflow.com/questions/37372466/changing-default-dropdown-value-in-sap-crm-web-ui
http://saptechnical.com/Tutorials/CRM/Dropdown/Index.htm