Friday, September 14, 2007

SAP Query Step-By-Step

T-code: SQVI

For Creating New SAP Query choose “CREATE
Give a name and click Create

Here we are creating SAP Query under the name “SAPQUERY” & ensure the description & the Data Source is been defined. In Data Source you have four options

1. Logical Database
2. SAP Query Info set
3. Table
4. Table Join

You can also choose “BASIS MODE” or “LAYOUT MODE”

Note: You can find the difference between “BASIS MODE” or “LAYOUT MODE” from the following screen shots.

Here I am Selecting Basis mode and select table join if more than two tables

After defining the selection criterions then you get the below screen for inserting the Tables from were you to have extract the Query

Now Click on Insert table button on top, and choose the table you require. In this example we are inserting two Tables VBRK and VBRP.


Choose Insert table Again and choose VBRP

Note: Ensure that when you join more than one tables the Primary keys should have linkage as in the below case the field name “VBELN” is the primary key were it is linked in both the tables.

Now Click on Check button for join conditions

Once you get the message “Defined Join conditions are correct”. In the bottom
of the screen then you can go back by clicking the back button.When you drill down you will find the list of fields used for the particular table in that we can select whether the particular field is only the listed field or the selection field or both.

Listed field is the Output field & the selection field is the Input field which has to be keyed in when generating the Query.

Below screen shot is shown for Table VBRK in that few fields are been selected for Listing as well as selectionAfter selecting the Listed & selected fields either by Basis or Layout mode check out for any errors click the check button.

After clicking you ensure that you get a message “NO errors were found during consistency checks” is seen at the bottom of the screen after seeing this message the Query can be saved by clicking the SAVE button


After saving the Created Query the Query can be executed by clicking the EXECUTE button

Adjust the number of records

Below screen appears in SAP List viewer
The output

No comments: