Skip to Content

In search screens in SAP CRM, you sometimes run in to the fact that for some reason, you are not able to select a search option you might want to be able to select. 

Screen Shot1.png

For instance in the example, let’s say we would like to select all activity types starting with ‘ZB*’. This is not possible in the standard, but there is a way around this. Let’s talk about ‘Query Objects in the Generic Interaction Layer (GenIL).


Query objects are used to find business objects within the BOL. Many of SAP’s business objects have queries implemented to support specific search conditions. These query objects can easily be found using the GenIL Model Browser.


Besides standard query objects, supporting only ‘values equal to’ searches, some of the query objects are implemented as ‘dynamic query objects’
Using these dynamic query objects it is possible to support multiple operators within the search. As said, it is possible. Not all dynamic query objects support all kinds of operators. This blog explains how to change the operators for dynamic query objects, to support custom specific search scenarios.

                                

1. Dynamic Query Object : Within this blog we will use component “BT”, dynamic query object “BTQAct”.

Using the BOL browser(GENIL_BOL_BROWSER – Browser for Business Object Layer) , we want to search for specific objects, where field “PROCESS_TYPE” is in between a range of values, but the dynamic query object doesn’t allow us to do so.BOL.png
Using the Generic Interaction Layer Model Browser it’s easy to locate the dynamic query objects for a specific business object.
Screen Shot2.png

2. Check default query operators

Since the dynamic query object doesn’t allow us to search with operator “BT” for field “PROCESS_TYPE”, we need to check what is causing this behavior. By double clicking the Dynamic Query Object, we get an overview of all allowed operators. As we can see, operator “BT” is supported for this query object.Screen Shot3.png

3. Check exceptions per attribute

The dynamic query object specifies which operators are allowed within the search. But this doesn’t mean that all fields allow these operators as well. It is possible to set exceptions. By double clicking the field within the dynamic query object, we can see all allowed operators for that specific field.

Screen Shot4.png
As we can see, operator “BT” is not allowed for field “PROCESS_TYPE”.

4. Define operators for dynamic queries

To change the operators for dynamic query object we need to open the customizing using path:
Customer Relationship Management -> CRM Cross-Application Components -> Generic Interaction Layer/Object Layer -> Component-Specific Settings -> Define Operators for Dynamic Queries
Spro.png
Spro2.png
Search for the corresponding component and dynamic query object. The customizing allows us to either change the default settings or the exceptions per attribute. In our specific case we need to change the exceptions per attribute and activate the “BT” operator.

5. Check new operator  and test for dynamic query

Since we have added the “BT” operator for our field, the BOL browser should now enable us to search using this operator.Test Query.pngLast result.png

Note: – In case the dynamic query object itself doesn’t supply the required values, meaning the newly added operator doesn’t work correctly, you’ll have to find / enhance the corresponding search implementation.

To report this post you need to login first.

7 Comments

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

  1. Shaik S

    Hi Arjun,

    Its was very help full info. Thank You!!  Appreciate if you could help me below issue.

    As per above details, I have added “NE” operator for Status field in service request. Now its showing NE operator in CRM WebUI. But when I try to search records with NE operator for status field its not working. It’s getting records having same status.

    When I debug the functionality, at 2 places in standard code, SAP directly hard coding EQ operator without considering webui input. Please find below object from below. Do I need to enhance standard code ?

    • Include: LCRM_BSP_OIC_1O_SEARCHF04  EXTEND_QUERY_FOR_MULTIVALUES(FORM)
    • CL_CRM_SRQM_SRV_REQ_RUN_BTIL(IF_CRM_QUERY_RUNTIME_BTIL~GET_DYNAMIC_QUERY_RESULT)

    Actually its hard coding at 3 places with “EQ” for status field in standard code, if I enhance at 2 places, then I can skip at 3rd place by writing code in BADI ES_CRM_RF_Q1O_SEARCH to fetch GUID’s.

    Kindly suggest Is there any other option that can be done this functionality without enhancing standard code.

    Thanks in advance!!

    Regards,
    Shaik

    (0) 
  2. Stephen Parnell

    Hi Arjun,

    Were you able to find a solution through config ?

    I have the same issue when adding NE to STATUS_COMMON for the BTQLeadDoc object.

    ‘is not’ shows up in the Web UI as an operator but the Search brings back the same result list as the EQ operator.

    I could not see any Notes on this.

    Thanks,

    Steve

    (0) 
    1. Hongyan Shao

      Please try to investigate into CL_CRM_REPORT_ACC_DYNAMIC DATABASE_ACCESS, and trace back in the call stack to find why NE is not considered.

      (0) 
  3. Anand Kunwar Singh

    Thanks Arjun for the helpful blog.

    When I am trying to save changes in step 4 (Comp Name BT, Dquery:BTQAICSearch), System is throwing below warning message:

    ”Do not Make any changes (SAP Entry)”.

    As this is a warning message, I believe that we can proceed with changes but Is there any alternative solution for this?

    Thanks!!

    Regards,

    Anand

    (0) 

Leave a Reply