Make Query Parameters Dynamic

  • by William R. Pritchett, Senior Business Process Engineer, Dow Corning Corporation
  • John Burton, Director Solution Management, SAP Interaction Center & Social CRM, SAP
  • March 18, 2013

Download a simple ABAP program that helps you make CRM saved searches more dynamic.

We wrote about maximizing the functionality of saved searches for the CRM hub of SAPexperts. To see how to make the saved search dynamic, you need to go back and review table CRMT_DYN_QUERY, which stores the query parameters. Use transaction code SE16 to find the table entry that corresponds to your saved search. Look carefully at the contents of field SELECTION_PARAM, and you see that the query parameters are stored as XML. Fortunately, you do not need to fully understand the XML structure to implement the desired functionality. You can simply treat the SELECTION_PARAM field as a character string and manipulate its contents to modify the query.

At a high level, you make the query dynamic by completing these steps:

  1. Retrieve the contents of the SELECTION_PARAM and store it as a template.
  2. Replace the static date parameters in the template with placeholders.
  3. As the date changes on a nightly basis, run a program that reads the template, replaces the placeholders with calculated values that reflect the new date, and overwrites the parameters stored on CRMT_DYN_QUERY.

The first step would be trivial, except for the fact that SELECTION_PARAM has a type of STRING and is too long to be fully displayed in transaction code SE16. Instead, you need to use a simple ABAP program to read the field and break it down into substrings that can be displayed. Download that program below.

William R. Pritchett

William (Bill) Pritchett has more than 25 years of IT industry experience and has worked at Dow Corning Corporation for the past 16 years. Over the past eight years he has focused on the company’s CRM systems and processes. His current responsibilities include expanding the capabilities of Dow Corning’s SAP CRM 7.0 system.

See more by this author

John Burton

John Burton is a director of product management at SAP and is responsible for the SAP CRM Interaction Center (including ERMS) and social CRM topic areas. John has 13 years of experience at SAP and has been involved with SAP CRM and the Interaction Center since 1999. He is also the author of Maximizing Your SAP CRM Interaction Center, available at the SAPinsider Store. John is an alumnus of the University of Michigan and Central Michigan University. John can be found on LinkedIn at

See more by this author


No comments have been submitted on this article. 

Please log in to post a comment.

To learn more about subscription access to premium content, click here.