Assigning SAP Queries to Transaction Codes

by Paul Ovigele

November 27, 2011

Paul Ovigele, Ovigele Consulting

SAP Queries can be accessed directly by going to transaction SQ01 and executing the relevant query. Some companies, however, do not like to give users access to this transaction as it could lead to users running a query which has a long runtime and could potentially cripple the system. An alternative therefore is to assign the query to a transaction code which you can then assign to the relevant users.

To assign a query to a transaction code to need to go to transaction SE93, enter the transaction code and click on the ‘Create’ button. Then enter a short text for the transaction code and click on the button “Transaction with Parameters (parameters transaction)”. When you hit the ‘Enter’ key, this will take you to the “Create Parameter Transaction” screen. In the ‘Default values for’ section, enter the value “START_REPORT” in the ‘Transaction’ field and check the box ‘Skip initial screen’. In the ‘GUI Support’ screen, check the boxes ‘SAPGUI for HTML’, SAPGUI for JAVA’ and ‘SAPGUI for windows’.

In the ‘Default values’ section at the bottom of the screen, enter the following values in the ‘Name of Screen Field’ and ‘Value’ columns:

D_SREPOVARI-REPORTTYPE: Enter the value “AQ” which is the code for SAP Query;

D_SREPOVARI-REPORT: Enter the user group that the query was created in. The infoset that the query is created from is assign to (at least one) user group and every query is created according to a user group.

D_SREPOVARI-EXTDREPORT: Enter the name of the query that you want the transaction code to be derived from.

D_SREPOVARI-VARIANT: If you have created a selection screen variant for your query then you can enter it here. This way the variant is automatically defaulted anytime you go to that transaction.

D_SREPOVARI-NOSELSCRN: If you want to skip the selection screen, enter an “X” in the value column. Otherwise you can leave it blank.

There are two types of queries – standard queries and global queries. If you are using standard queries, then you need to manually trigger a transport request. In this case you would assign the user group to the screen field D_SREPOVARI-REPORT as explained above. If you are using global queries (which are available in all clients in the instance), the system automatically triggers a transport request. In this case you would need to add a suffix of “G” to your user group when assigning it to the screen field D_SREPOVARI-REPORT. Note that when you do this, the “G” character needs to be in the thirteenth position of the field. For example, if you have a user group named ZFIUSER, you would need to leave five spaces before assigning the G character. The field value would therefore be “ZFIUSER     G”.

One advantage of using global queries is that you can take advantage of queries that have been set up by SAP (such as vendor, customer and general ledger evaluations) and simply assign them (as described in the above steps) to transaction codes so that they are available to the relevant users.

For more information on how to optimize your SAP Financials landscape, I've put together my top tips in the book 100 Things You Should Know About Financial Accounting with SAP  which is published by SAP Press.

An email has been sent to:

More from SAPinsider


Please log in to post a comment.

No comments have been submitted on this article. Be the first to comment!