Like the InfoSet query, you use SAP Query to display data fields from InfoSets. The basis of each query is therefore also an InfoSet in this case. Unlike the simpler InfoSet query, however, the SAP Query offers a large number of additional structural options. You would therefore create an SAP Query if you determine that you want to run a particular database query frequently, and want it to be flexible to operate. SAP Queries are always accessible to all members of your own user group. However, they can also be assigned to other user groups.
Before you can create a query, three basic prerequisites must be fulfilled (usually by the system administrator):
Prerequisite 1: You have the appropriate authorization.
To execute an SAP Query or an InfoSet query, you require authorization for transaction SQ01. If you do not have this authorization, contact your system administrator.
Prerequisite 2: You are assigned to a user group.
All users that want to create or execute queries, must be assigned to at least one user group. The relevant system administrator usually performs the Administration of User Groups. If you only want to execute a query, you do not require any additional authorizations. You only require a special authorization if you want to create or save a query. Contact your system administrator in these situations, too.
Prerequisite 3: Suitable InfoSets exist
An InfoSet is a special view of a data source. The structure of an InfoSet is based on the information requirements of the user.
A special authorization is usually required to create an InfoSet and to maintain its properties. Therefore, contact your system administrator to identify the required InfoSet for your tasks, or to have it created. InfoSets can be assigned to different user groups. A suitable InfoSet may already exist for another user group, meaning that only the assignment of this InfoSet needs to be adjusted.
As soon as a suitable InfoSet is available for your user group, you can generate a query for it:
Call transaction SQ01. The SAP Query initial screen appears. This screen shows a table of all queries that have been created and stored for your user group.
To execute an existing query, select it from the table, and choose Execute (F8).
To create a new query, enter a name for it, and choose the Create button.
A new dialog box appears, showing all available InfoSets. Choose the InfoSet that you require for your query and confirm the dialog.
On the Create Query screen, enter a title and a description for your query. All other entries are optional, and are filled with default values if you do not make specifications.
Choose the Basic List button.
On the following screen, you can select the fields for the selection or list display in the tree structure in the top left. On the right, you can, if necessary, adjust the screen for the list output.
Choose the Test button and confirm the following Variants dialog without making an entry.
The selection fields that you have just selected are ready for input on the next screen. Enter valid values there and then choose Execute (F8).
If you want to save this SAP Query, you first need to maintain a Variant for it. You can then save the entire SAP Query in a suitable package.
The procedure listed above lists the basic steps to be performed in the context of working with SAP Queries. If you work more frequently with SAP Queries and want to use the many options, you can find detailed information in the following sections about the individual components of SAP Query.