Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Table Name: ABAP Query standard variant

Former Member
0 Kudos

Team,

Some abap queries are started with Standard Variant. I want to know where this one to one relation is maintained. What is the table name?

I already know the following:

Field: TRDIR-SSET flags if a query has a standard variant

Table: VARID has only variat names. It does not say it is standard variant.

I am creating 500 ztcodes (via BDC se93) for ABAP Queries and want to put Standard Variant for a given ABAP query. These Standard Variants already exists. I AM NOT CREATING Std Variants. I am only creating Ztransaction codes for existing ABAP Queries which has existing Std Variant. In SE93, there is a place for std variant called 'start with a variant'.

There must be a flag where this is maintained.

Thanks

Message was edited by: SAPna2000

Message was edited by: SAPna2000

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hello,

You can check the variants in table TVARV and also

check table SHDTV

you can create variants through transaction SHD0(zero).

Reward if helps.

Regards,

Krishnakumar

26 REPLIES 26

Former Member
0 Kudos

Hello,

You can check the variants in table TVARV and also

check table SHDTV

you can create variants through transaction SHD0(zero).

Reward if helps.

Regards,

Krishnakumar

0 Kudos

Krishnakumar,

I am not creating variants. I am creating ztransaction codes for existing ABAP queries which already has Std Variant.

I want to know the table name where a Variant is 'flagged' as Std Variant.

Thanks

0 Kudos

Hello,

Please check the table SHDTV and also table TVARV.

Reward if it helps.

Regards,

Krishna

0 Kudos

table SHDTV: "Transaction variants" - has nothing to do with ABAP query Std Variants

table TVARV: "Table of variables in selection criteria" - has nothing to do with ABAP query Std Variants

0 Kudos

Are you looking for standard variants begin with SAP&** for ABAP querys program name begining with AQ***

Check in table VARID with client = 000

select * from varid client specified into table gt_varid

where mandt = '000'

and report = report_name.

Regards

Sridhar

0 Kudos

sridhar,

My queries are in client 010.

***The code below does not return Std Variant for my Query**

select * from varid client specified into table gt_varid

where mandt = '000'

and report = report_name.

0 Kudos

You can do like

<b>Custom Var</b>

select * from varid client specified into table gt_varid

where mandt = '010'

and report = report_name.

OR

select * from varid client specified into table gt_varid

where report = report_name.

<b>standard VAR...</b>

select * from varid client specified into table gt_varid

where mandt = '000'

and report = report_name.

Thx

Saquib

0 Kudos

Standard variants assigned to SAP standard queries are stored in client 000.

Are you refering to custom queries? check standard variant created and assigned to the query in SQ01.

If a standard variant is assigned to the query and not actually created then it won't exist in VARID.

Regards

Sridhar

0 Kudos

You can also try the following FM

call function 'RS_VARIANT_CATALOG'

exporting

report = report (

Query name

)

DYNNR = 0180

<u>As standard variant screen number is 0180</u>

importing

sel_variant = variant

exceptions

others = 1.

if sy-subrc = 0.

varname = variant.

else.

message s224.

endif.


FYI How SQ01 Pick up the standard variant


Also check the prog :SAPMS38R screen # 0180 , at the bottom of flow logic


process on value-request.

field rs38r-stdvariant module stdvariant_f4.

module stdvariant_f4 input.

perform variant_f4 using repid rs38r-stdvariant.

endmodule. "STDVARIANT_F4

form variant_f4 using repname type pgname
varname type vari.

data: report like rsvar-report,
variant like rsvar-variant.

report = repname.
if report(1) = '!'. " temporärer Report
report(1) = 'A'.
endif.
call function 'RS_VARIANT_CATALOG'
exporting
report = report
importing
sel_variant = variant
exceptions
others = 1.
if sy-subrc = 0.
varname = variant.
else.
message s224.
endif.

endform. "VARIANT_F4




Hope this’ll give you idea!!

Pl... award the points.

Good luck

Thanks

Saquib Khan

"Some are wise and some are otherwise"

0 Kudos

Yes. I am only referring to custom ABAP Queries. My Standard Variant exist in VARID along other variants for the same query. In VARID standard variant is not distinguishable from other variants.

There must be a table...

0 Kudos

Query attributes and definition are stored in table aqgdb. use the following code to get standard variant name:

data: begin of fs_qukey,

ch(2) type c,

prefx type aqadef-bgname,

qnum type aqadef-quname,

end of fs_qukey.

data: begin of headqu.

include structure aqhdqu.

data: end of headqu.

fs_qukey-ch = 'QU'.

fs_qukey-prefx = 'USER_GROUP'. "User group name

fs_qukey-qnum = 'QUERY_NAME'. "Query name

import headqu

from database aqgdb(aq) id fs_qukey

ignoring conversion errors.

if sy-subrc eq 0.

write:headqu-quvariant.

endif.

Regards

Sridhar

0 Kudos

This fm returns a variant which is not necessarily the 'Standard Variant'. I tried it.

0 Kudos

Are you talking baout this FM , are you using it this way ?

It returns you the variant which you maintain in SQ01 n Query )

call function 'RS_VARIANT_CATALOG'

exporting

<b>report = report ( Query name )

DYNNR = 0180 As standard variant screen number is 0180</b>

importing

sel_variant = variant

exceptions

others = 1.

if sy-subrc = 0.

varname = variant.

else.

message s224.

endif.

Thx

Saquib

0 Kudos

Yes. I am using it in SE37. The following occurs:

DYNNR = 0180 (I get pop up window with ONE variant to select from which is not the std variant)

DYNNR = 1000 (I get pop up window listing ALL variants for the query)

DYNNR = Any other number (I get pop up window with ONE variant to select from which is not the std variant)

0 Kudos

The standard variant with variant name gets stored in <b>AQGDB</b> table

Regds

Manohar

0 Kudos

When I`m executing with screen # 180 , I`m getting one variant which I assigin in SQ01 ..

<b>Have you tried Sridhar option ?</b>

data: begin of fs_qukey,

ch(2) type c,

prefx type aqadef-bgname,

qnum type aqadef-quname,

end of fs_qukey.

data: begin of headqu.

include structure aqhdqu.

data: end of headqu.

fs_qukey-ch = 'QU'.

fs_qukey-prefx = 'USER_GROUP'. "User group name

fs_qukey-qnum = 'QUERY_NAME'. "Query name

import headqu

from database aqgdb(aq) id fs_qukey

ignoring conversion errors.

if sy-subrc eq 0.

write:headqu-quvariant.

endif.

Thx

Saquib

0 Kudos

Get the report name using the function module RSAQ_REPORT_NAME. You have to use this as the report name is dynamically generated in each environment.

Use this report name to get the variants from VARID like Sridhar explained.

0 Kudos

Are your queries, infoset queries or SQVI queries?

0 Kudos

((When I`m executing with screen # 180 , I`m getting one variant which I assigin in SQ01 ..))

If you have more than one variant then you will get different answer...

0 Kudos

They are infoset queries...with multiple variants and only one Std Variant. The VARID table lists all the variants - I can't tell which one is a std variant. The only way I can find the std variant is to open each query in SQ00 and double click on it...

Message was edited by: SAPna2000

0 Kudos

Standard variants start with SAP& so you have to put that as part of the select statement.

SELECT variant INTO v_variant CLIENT SPECIFIED
                     FROM varid
                    WHERE mandt = '000'
                      AND report = report_name
                      AND variant LIKE 'SAP&%'.

0 Kudos

Srinivas,

I am dealing with 500+ custom ABAP Queries. And my queries are in client 010. And each query has more than one variant but only one standard variant.

0 Kudos

Even though your queries are in client 010, the standard variant will have to be selected from client 000 only. Combine the function call that I gave earlier with the select statement that I gave later, you should get your standard variant. Is that not happening? Please give the code you have so far.

Manohar2u
Active Contributor
0 Kudos

You have to attach the variant form SHDO (as Standard variant tab) and activate it.

Regds

Manohar

Former Member
0 Kudos

Manohar,

I don't know the Std Variant in advance (I have 500 queries - And I can't open each one and get the Std Variant name).

There must be a table where this is stored.

Thanks

Naved

Former Member
0 Kudos

This is a very old thread but I have the same issue, you described it well.  Did you ever find a table without having to access client 000?  Seems like it has to be there someplace.

Thanks,

Mark