cancel
Showing results for 
Search instead for 
Did you mean: 

table to findout the list of variables created for a Bex query

anil_babu13
Participant
0 Kudos

Hi Experts,

Is there any way to find out the list of variables created for a Bex query in Query designer?

Thanks,

Anil

Accepted Solutions (0)

Answers (3)

Answers (3)

swati_gawade
Contributor

Hi Anil,

Table RSZGLOBV will give you list of all the variables in your system.

If you wish to see only custom variables then in the selection just enter Z* and execute the table and you will get the entire list of custom variables.

Hope this helps.

-Swati.

Former Member

table tadir

table rszcompdir

remember to assign points 🙂

karthik_vasudevan
Active Contributor
0 Kudos

Hi Anil

RSRTQ is the tcode to get the information.

Th Tcode will show you the below options. You could choose input variables and execute with your query name.

Hope this helps

Regards

Karthik

Former Member
0 Kudos

Try Below program. This is gives output directly once you input your variable name.


*&---------------------------------------------------------------------*

*& Report ZBW_VAR_WHERE_USED

*&

*&---------------------------------------------------------------------*

*& TITLE: Find the where used list of Bex variables in queries and DTPs

*&

*& CREATED ON: 12.12.2010

*&

*& CREATED BY: Sucheta

*&

*& DESCRIPTION: This program can be used to find what Queries and DTPs

*& a particular variable is used in.

*&---------------------------------------------------------------------*

REPORT  zbw_variable_where_used.

************************* Type Declarations ****************************

TYPES:

BEGIN OF ty_output,

infocube TYPE rsinfocube, "Infoprovider name

compid TYPE rszcompid, "Query Technical Name

txtlg TYPE rstxtlg, "Query Description

author TYPE xuauthor, "Query Owner

lastuser TYPE last_user, "Last Changed by

END OF ty_output.

************************* ALV References *******************************

DATA: go_alv TYPE REF TO cl_salv_table,

go_columns TYPE REF TO cl_salv_columns,

go_funcs TYPE REF TO cl_salv_functions,

go_ex TYPE REF TO cx_root.

************************* Internal Tables ******************************

DATA:

varid TYPE sysuuid_25,

it_output TYPE STANDARD TABLE OF ty_output,

it_rszglobv TYPE STANDARD TABLE OF rszglobv,

it_rszeltcomp TYPE STANDARD TABLE OF rszeltxref,

it_rszeltquery TYPE STANDARD TABLE OF rszeltxref,

it_results TYPE STANDARD TABLE OF rszeltxref,

it_rsoobjxref TYPE STANDARD TABLE OF rsoobjxref,

it_rszeltprop TYPE STANDARD TABLE OF rszeltprop,

it_rsrrepdir TYPE STANDARD TABLE OF rsrrepdir,

it_rszelttxt TYPE STANDARD TABLE OF rszelttxt,

it_rszeltxref TYPE STANDARD TABLE OF rszeltxref,

it_rshredir TYPE STANDARD TABLE OF rshiedir.

************************* Work Areas ***********************************

DATA:

wa_output TYPE ty_output,

wa_rsrrepdir TYPE rsrrepdir,

wa_rszelttxt TYPE rszelttxt,

wa_rszeltcomp TYPE rszeltxref,

wa_rszglobv TYPE rszglobv,

wa_rszeltprop TYPE rszeltprop,

wa_rsoobjxref TYPE rsoobjxref.

************************************************************************

* SELECTION SCREEN DETAILS

************************************************************************

*

* Select from the variable name, Also select in Queries or DTPs

*

SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.

PARAMETERS: p_var LIKE rszglobv-vnam.

SELECTION-SCREEN END OF BLOCK blk1.

SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002.

PARAMETERS: r_qry RADIOBUTTON GROUP rg DEFAULT 'X',

r_dtp RADIOBUTTON GROUP rg.

SELECTION-SCREEN END OF BLOCK blk2.

************************************************************************

* SELECTION OF DATA

************************************************************************

* Check the validity of the input

SELECT SINGLE varuniid FROM rszglobv INTO varid WHERE vnam = p_var.

IF sy-subrc <> 0.

* No variables exists of that name

   MESSAGE 'No Variable exists of this name' TYPE 'I'.

   EXIT.

ENDIF.

*What about the DTP

IF r_dtp = 'X'.

*DTP reference stored in table RSOOBJXREF

   SELECT *

   FROM rsoobjxref

   INTO TABLE it_rsoobjxref

   WHERE objvers = 'A' AND

   objnm_dep = p_var.

   IF sy-subrc <> 0.

     MESSAGE 'The variable has no references to DTPs' TYPE 'I'.

     EXIT.

   ELSE.

     WRITE: / 'The variable is contained in the below DTPs'.

*Now lets do the display of the results

     LOOP AT it_rsoobjxref INTO wa_rsoobjxref.

       WRITE: / wa_rsoobjxref-objnm.

     ENDLOOP.

   ENDIF.

ELSE.

*Now get the reference ID's for this unique eltuid's.

*So we now can get the containing elements of our

*variable element.

   SELECT *

   FROM rszeltxref

   INTO TABLE it_rszeltcomp

   WHERE objvers = 'A' AND

   teltuid = varid.

   LOOP AT it_rszeltcomp INTO wa_rszeltcomp.

*check if we have a top level element

     IF wa_rszeltcomp-laytp = 'SHT' OR wa_rszeltcomp-laytp = 'SOB'.

*Add to the results

       APPEND wa_rszeltcomp TO it_results.

     ELSE.

*Otherwise keep searching

       SELECT *

       FROM rszeltxref

       INTO TABLE it_rszeltquery

       WHERE objvers = 'A'

       AND teltuid = wa_rszeltcomp-seltuid.

       APPEND LINES OF it_rszeltquery TO it_rszeltcomp.

     ENDIF.

   ENDLOOP.

   IF sy-subrc = 0.

* Now get the actual reports from reporting table.

* So we should the query details now.

     SELECT *

     FROM rsrrepdir

     INTO TABLE it_rsrrepdir

     FOR ALL ENTRIES IN it_results

     WHERE objvers = 'A' AND

     comptype = 'REP' AND

     compuid = it_results-seltuid.

     IF sy-subrc = 0.

* get the query txt description for all found queries.

       SELECT *

       FROM rszelttxt

       INTO TABLE it_rszelttxt

       FOR ALL ENTRIES IN it_rsrrepdir

       WHERE objvers = 'A' AND

       eltuid = it_rsrrepdir-compuid.

     ENDIF.

   ENDIF.

* Loop through the descriptions and also assign the

* texts to the output to make this more clear.

   LOOP AT it_rsrrepdir INTO wa_rsrrepdir.

     CLEAR: wa_output, wa_rszelttxt.

     MOVE-CORRESPONDING wa_rsrrepdir TO wa_output.

* get the query description.

     READ TABLE it_rszelttxt INTO wa_rszelttxt WITH KEY

     eltuid = wa_rsrrepdir-compuid.

     IF sy-subrc = 0.

       wa_output-txtlg = wa_rszelttxt-txtlg.

     ENDIF.

     APPEND wa_output TO it_output.

   ENDLOOP.

   TRY.

       cl_salv_table=>factory(

       IMPORTING

       r_salv_table = go_alv

       CHANGING

       t_table = it_output ).

       " set column optimized

       go_columns = go_alv->get_columns( ).

       go_columns->set_optimize( ).

       " set functions

       go_funcs = go_alv->get_functions( ).

       go_funcs->set_all( ).

       go_alv->display( ).

     CATCH cx_salv_msg INTO go_ex.

       MESSAGE go_ex TYPE 'E'.

   ENDTRY.

ENDIF.

Loed
Active Contributor
0 Kudos

Hi,

I think the easiest way is the suggestion of Karthik..Just go to tcode RSRTQ, enter your query name then EXECUTE..It will give you already the result..

Regards,

Loed

Former Member
0 Kudos

Above program will give Where-used list of Queries/DTPs for a variable.