Using a Variant to Populate Queries with Default Parameters

Jimbo's picture

It might sound like a trivial task, but until the necessity arrives, one may not ever learn how to populate the fields in a query with default values. In one case, a client wanted a query to have the same 10 customers populated automatically when the query was run by any user.

Start by creating the Infoset in SQ02, create the Infoset Query in SQ01 and then run the Query. On the first screen of the Query, populate the parameters with the desired values and then click on Goto→Variants→Save as Variant... (or click Ctrl+S).

Next, save the parameters as a variant. There are several other fields on this screen that give the developer of the query a great number of options, but populating the parameters of the query is the purpose of this whitepaper.

Be sure to provide a meaningful name and description. This query is very specific so only one variant is used to populate the parameters with default values.

Finally, edit the query and plug the variant into the Standard Variant field. If the query should only be run with the variant then be sure to tick the "Execute only with variant" checkbox.

Now the same values will always be defaulted when the query is run by any user. This solution obviates the need for any ABAP code or a transport request.|||||||||||||