Summary
This article gives clear picture about how to copy Bex query from a destination system to the source system by running a custom program.
Introduction
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
Scenario
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:
RSZ_X_COMPONENT_GET:
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.
RSZ_X_COMPONENT_SET:
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 |
RSZRANGE | Selection specification for an element |
Caution:
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.
Recommendation:
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.
Conclusion:
Using an ABAP program with the above function modules described, we can copy the Bex query across the systems.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
5 | |
5 | |
4 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |