Technology Blog Posts by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Srinivasasa_D_M
Explorer
0 Kudos
434

In continuation of my previous blog (Section 5 of All about Bex Query elements in SAP BW/BW4HANA - SAP Community), this post focuses on example involving Restricted Key Figures (RKFs) in SAP BW/BEx queries.

In this blog, I explain the best way to extract or identify the selection criteria applied in RKFs that are used in the rows or columns of a BW/BEx query.

When a query contains only a few rows or columns (e.g., 5–10), it's relatively easy to manually check the selections used in each RKF. However, in more complex reports such as Balance Sheet or Income Statement reports with over 50 rows manually checking each row or column becomes time consuming and inefficient.

To overcome this challenge, we can leverage backend SAP BW tables to extract the relevant details and analyze them in Excel. The key tables involved in this process are:

  • RSRREPDIR – Query directory
  • RSZELTXREF – Element cross-reference
  • RSZRANGE – Selection ranges
  • RSZELTDIR – Element directory

By correlating these tables, we can efficiently retrieve the selection criteria used in RKFs that are used in the rows or columns of a BW/BEx query, saving significant manual effort.

Steps to Identify Selections Used in RKFs in Rows and Columns of a BW/BEx Query.

Step 1: In the Table RSZCOMPDIR / RSRREPDIR enter the query technical name in the field COMPID to obtain the COMPUID of the query.Screenshot 1 : Output of RSRREPDIR tableScreenshot 1 : Output of RSRREPDIR table

Step 2: In the RSZELTXREF table, enter the COMPUID of the query (from step 1) in the field SELTUID to obtain TELTUID.Screenshot 2 : Output of RSZELTXREF tableScreenshot 2 : Output of RSZELTXREF table

Step 3: Again, in the RSZELTXREF table, enter TELTUID (from step 2, where LAYTP = ‘SOB’) in the field SELTUID and execute the table.Screenshot 3: Output of RSZELTXREF tableScreenshot 3: Output of RSZELTXREF table

Step 4: Again, in the RSZELTXREF table, enter TELTUID (from step 3, where LAYTP = ‘COL/ROW’) in the field SELTUID and execute the table.Screenshot 4 : Output of RSZELTXREF tableScreenshot 4 : Output of RSZELTXREF table

Note : If there are direct selections (i.e., no RKFs) used in the rows/columns of the query, you can skip Step 5 & 6 and proceed directly to Step 7.

Step 5: Again, in the RSZELTXREF table, enter TELTUID (from step 4) in the field SELTUID and execute the table.Screenshot 5 : Output of RSZELTXREF tableScreenshot 5 : Output of RSZELTXREF table

Repeat Step 5 until the RSZELTXREF table returns zero entries.

Step 6: Collect all TELTUID values from the previous steps into an Excel sheet and remove any duplicates.Screenshot 6 :  List of all TELTUIDs from all stepsScreenshot 6 : List of all TELTUIDs from all steps

Step 7:  Go to the RSZRANGE table and enter the TELTUID values (from Excel) into the SELTUID field. Execute the table to retrieve the selection details used in the rows and columns.Screenshot 7 : Selection detailsScreenshot 7 : Selection details

Step 8: Open the RSZELTDIR table and enter the same TELTUID values (from Excel) into the SELTUID field. Execute the table to get the technical names and descriptions of the elements.Screenshot 8: Technical names and descriptions of the elementsScreenshot 8: Technical names and descriptions of the elements

Step 9: Download the outputs from Step 7 and Step 8 into Excel. Use the VLOOKUP formula to match and enrich the selection data from Step 7 with the descriptions from Step 8 Screenshot 9 : Final output with all required detailsScreenshot 9 : Final output with all required details

Conclusion : In complex SAP BW/BEx queries, especially those used in financial reports with numerous rows and columns, manually identifying selection criteria in Restricted Key Figures (RKFs) is inefficient. By leveraging backend BW tables such as RSRREPDIR, RSZELTXREF, RSZRANGE, and RSZELTDIR, users/Developers can systematically trace and extract RKF selections. This approach enables efficient analysis in Excel, significantly reducing manual effort and improving transparency in query design.

Happy Learning 😊