Skip to Content

Copy BW Bex Queries across systems


This article gives clear picture about how to copy Bex query from a destination system to the source system by running a custom program.


  Using an ABAP program we can copy the Bex query across the systems. There are scenarios like, the Bex Query is developed directly in production system and in order to have all the systems (development, test and production) in line, we might want to copy the queries across the systems without recreating in each of the systems which is time consuming. Instead, we can create a custom program to copy the queries between the systems


Let’s take an example of a Bex query “ZTEST_QUERY1” which is available in production system ‘PRO’ to be copied to Development system ‘DEV’.

Function modules


Custom program Explained

Let’s create a custom program ZCOPY_QUERY with a selection screen allowing the user to provide the Query name in the destination system, destination system name and name to be copied to the source system.

Selection Screen:



Function module RSZ_X_COMPONENT_GET is used to get the Query elements of the query in the production system PRO.

The above function module reads the query definition from the remote system.

Modify internal table IT_ELTDIR with the new query name to be copied to. 


Function module RSZ_X_COMPONENT_SET is used to create a query in the source system.

Once the program is executed with these two function modules described above the query will be copied to the source system as expected.


Tables being used:

RSRREPDIR     Directory of all reports
RSZCOMPIC     Assignment reusable component <Infocube>
RSZCOMPDIR   Directory of reporting components
RSZELTXREF    Directory of query element references
RSZGLOBV      Global Variables in Reporting
RSZELTDIR     Directory of the reporting component elements
RSZCALC          Definition of a formula element
RSZELTPROP Element properties (settings)
RSZELTPRIO Priorities with element collisions
RSZSELECT Selection properties of an element

Selection specification for an element


Copying procedure also copies all reusable component used in this query. Such as, Calculated Key Figures, Restricted Key Figures, Structures, Variables and Selection Objects. Someone would only identify these duplicated components only when the query is opened using Bex 7.X or higher, this could cause many inconsistencies when running reports.

Use report ANALYZE_RSZ_TABLES (notes 792779 and 853826) for detection of both situations (Table RSZCOMPDIR). The program allows renaming of duplicated queries and query components.





Recommended workaround is to use ‘Save As…’  functionality. This can be achieved by passing I_COPY_MODE = “L” in the function module RSZ_X_COMPONENT_SET_NEW.



Using an ABAP program with the above function modules described, we can copy the Bex query across the systems.

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