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.

http://www.sonatype.org/nexus/content/uploads/2015/03/Dilbert.jpg|https://media.licdn.com/mpr/mpr/p/8/005/08e/0bf/1487518.jpg|http://globalnerdy.com/wordpress/wp-content/uploads/2007/11/dilbert-xp02.gif|http://4.bp.blogspot.com/-33iVa9zpZw4/T_dI03N2qmI/AAAAAAAADqQ/5hlnPjVVuM8/s1600/1791.strip_.gif|http://i.imgur.com/s4nC9jm.gif|http://www.mscha.net/tmp/dt19920908.gif|https://qph.ec.quoracdn.net/main-qimg-20863c58063b2bff1d462a654174946e-c?convert_to_webp=true|https://image-store.slidesharecdn.com/128c6f87-a881-41cb-ad46-ace12bd27e3f-large.png|https://c1.staticflickr.com/3/2776/4120452966_7c221cfa2c.jpg|http://www.itamer.com/images/mordac.jpg|http://alchymie.typepad.com/acoa/images/kworking_1.jpg|http://www.acting-man.com/blog/media/2015/05/dilbert-steering-committee1.gif|https://media.licdn.com/mpr/mpr/shrinknp_800_800/AAEAAQAAAAAAAAdRAAAAJDYzMGFmZmI4LWVmNWItNDA4NS05MzA1LTRlMGE1ODAxMmU4Mg.jpg|http://keycorner.org/pub/image/comic/dilbert/66484.strip.sunday.gif