Read the Query Element Details based on Transport Request.
Summary
This document specifies to get the definitions of the query based on the transport request and the elements of the query.
Scenario
In BW, we will not get the details of the query elements in a transport request in a single click method. For getting the details, we need to check in the tables RSRREPDIR and RSZELTDIR. This report minimizes the time and effort to find out the query elements. The solution of this ABAP logic is to get the Query Element Details based on the Transport Request/Task or Query Element ID.
Program Functionalities
Inputs
- Transport Request/Task
- Query Element ID
Outputs
- A detailed report displayed with fields as Report Name, Element name, Element Type and Description
Tables Used
- rszeltdir
- rszelttxt
- rszcompdir
- e071
Step by Step Solution
Transport Request having Query Elements
ABAP Code Logic
- Execution.
Transport Request having Query Elements.
The transport request having query elements does not contain the details and it only gives the ID of each element under that transport request.
ABAP Code Logic.
- Go to T.Code SE38
- Create an executable program
- Copy the below code and save.
Tables: rszeltdir, “query element table
rszelttxt, “query element texts
rszcompdir, “global query elements
e071. “objects in transport requests
*parameters
parameters: Req_id like e071-trkorr.
*selection screen to input long ID 25 char generated name
select-options: long_ID for rszeltdir-eltuid.
*itab to hold related info
data: begin of i_query_desc occurs 0,
local, “Local to Query
eltuid like rszeltdir-eltuid, “25 char generated ID
compid like rszcompdir-compid, “technical name
deftp like rszeltdir-deftp, “element type
el_txt(16), “element type text
txtlg like rszelttxt-txtlg, “long text
owner like rszcompdir-owner, “owner
end of i_query_desc.
data: xlocal.
sy-tvar0 = Req_id.
*find all query objects for transport request entered
select * from e071 where trkorr = req_id and object = ‘ELEM’.
* add them to the select-options list
long_ID-low = e071-obj_name.
append long_ID.
clear long_ID.
endselect.
*loop through select option table and find details of Query element
Loop at long_ID.
clear: i_query_desc,
rszeltdir,
rszelttxt,
rszcompdir,
xlocal.
select single * from rszeltdir where eltuid = long_ID-low and objvers = ‘A’.
if sy-subrc <> 0.
write: / long_ID-low, ‘ Query element not found.’.
write: / .
else.
select single * from rszelttxt where eltuid = long_ID-low and objvers = ‘A’.
endif.
select single * from rszcompdir where compuid = long_ID-low and
objvers = ‘A’.
if sy-subrc <> 0.
* write: / long_ID-low, ‘ not found in table RSZCOMPDIR.’.
xlocal = ‘X’.
endif.
* fill itab for list
i_query_desc-local = xlocal.
i_query_desc-eltuid = rszeltdir-eltuid. “25 char generated ID
i_query_desc-compid = rszcompdir-compid. “technical name
i_query_desc-deftp = rszeltdir-deftp. “element type
case i_query_desc-deftp.
when ‘SEL’.
if xlocal = ‘X’.
i_query_desc-el_txt = ‘Selection’.
else.
i_query_desc-el_txt = ‘Restricted K/Fig’.
endif.
when ‘REP’.
i_query_desc-el_txt = ‘Query’.
when ‘VAR’.
i_query_desc-el_txt = ‘Variable’.
when ‘STR’.
i_query_desc-el_txt = ‘Structure’.
when ‘CKF’.
i_query_desc-el_txt = ‘Calculated K/Fig’.
when ‘FML’.
i_query_desc-el_txt = ‘Formula’.
endcase.
i_query_desc-txtlg = rszelttxt-txtlg. “long text
i_query_desc-owner = rszcompdir-owner. “owner
append i_query_desc.
clear i_query_desc.
- endloop. “@ long_ID
* list results
sort i_query_desc by local deftp owner.
loop at i_query_desc.
write: / sy-vline,
i_query_desc-eltuid, sy-vline, “25 char generated ID
i_query_desc-compid , sy-vline, “technical name
i_query_desc-deftp , sy-vline, “element type
i_query_desc-el_txt, sy-vline, “element text
i_query_desc-txtlg(40) , sy-vline, “long text
i_query_desc-owner , sy-vline.
write: sy-uline .
- endloop.
Execution
Selection Screen
Provide the Transport Request or Query Element ID to get the details. If you want to know the definition of only one element, you need to provide the particular query element id in LONG_ID field.
Output
The output contains the definitions of each query element in which we can see the Query Element Type and Description also.
Nice and usefull!