Skip to Content
Author's profile photo Former Member

Getting the SQL-Select-Statement of a Query in WebUI


I often wondered how the SQL-Select-Statement of a Query in WebUI looks like. For this you could use the SQL-trace of transactions ST01 or ST05. Alternatively you could put a breakpoint in class CL_CRM_REPORT_ACC_DYNAMIC method DATABASE_ACCESS.

Situation: You have some kind of business query in WebUI and you wonder how the SQL_Select-Statement is


Step 1: You put a break-point in the mentionned method


Here you see the From- and Where-statements.

Step 1a: Add a dynamic break-point for select-statements by pressing F9


Of course this will give you much more positions in coding.

Good luck when investigating.

Best regards,

Thomas Wagner

Assigned Tags

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

      Hi Thomas Wagner,

      I am happy to see this information on online. I really appreciate your time.

      After struggling and found this in debug like you. I was using this class and method from more than 2 years to check actual SQL statement on dynamic search query and it is my saver always.

      Few points adding from side.

      1. The method of lr_cod_helper->preprocess in BTIL search class (method IF_CRM_QUERY_RUNTIME_BTIL~GET_DYNAMIC_QUERY_RESULT) will play big role in preparing the where clause.

      2. You do the search with partner functions (like, sold to party, employee name, etc...) then observe the where clause in the CL_CRM_REPORT_ACC_DYNAMIC method DATABASE_ACCESS.

      This observation helps how to override the limitation of search with more than 2 partner functions at a time.



      Author's profile photo Parveen Kumar
      Parveen Kumar

      Hello Thomas,

      Thanks for sharing. Adding to this , I have noticed that the value in the variable i_up_to_n puts the limit on the number of GUIDs which are returned from the crmd_order_index. This value at times is increased to 5199 in inbox searches and further filtering is carried out after reading all the attributes of the transactions.



      Author's profile photo Ratna Rajesh .P
      Ratna Rajesh .P

      Hey Thomas,

      Really a very helpfull information thanks for sharing!!!!