You are on page 1of 25

Copyright2008 You can not redistribute, sell or change content of this e-book without written permission from the

author Important: The author and publisher have made every effort to ensure the accuracy of the information herein. However, the information contained in this book is distributed without warranty, either express or implied. Neither the authors nor its distributors will be held liable for any damages to be caused either directly or indirectly by the instructions contained in this book, or by the software or hardware products described herein.

How to create a SAP Query using InfoSet There are different types of queries available in SAP. This is a very interesting, simple and very effective tool. Today I am going to show you how you can create a query using InfoSets. There are three main steps in writing a query. They are; 1. Creation of User Groups (Defines who is going to create, modify and use the query) 2. Creation of InfoSet (Defines the set of data used in the query) 3. Creation of the Query (Generating reports using the data) Generally there is no need for you to carryout the first two steps for every query you write. Once created you can reuse them in queries. But for this demonstration I am taking you through these steps as well. For this demonstration I will create a user group called DEMO. I want to write a query to pull information regarding purchase orders. I need purchase order header data, purchase order line item data and account assignment data to generate my report. Step 1: Creation of User Groups (Transaction SQ03) 1. Go to the screen SQ01 2. Enter the Group Name you want to create and press Create

3. Then you can enter a description to the user group and press save

http://www.sapafs.net

4. Now you have created the User Group called DEMO

http://www.sapafs.net

Step 2: Creation of InfoSet (Transaction SQ02) 1. Go to the transaction SQ02 2. Enter a Name to your InfoSet and Press the Create Button

3. You will get the PopUp window. a. Enter the Descriptive name to your InfoSet b. Select the data source you are going to use. I am using table join to get the maximum flexibility c. Enter the First table you are going to get the data from( I am entering the table EKKO to get the header data of purchasing dosuments) 4. Press Continue

http://www.sapafs.net

5. Now you will see the table you inserted. To insert other tables click on the Insert Table Button

6. In the PopUp window type the table you want to insert next and press continue. I am inserting the PO Line Item level data table EKPO here

7. Enter the Continue button. You will see the tables with automatic joining

http://www.sapafs.net

8. Then hit the Insert Table button Again and enter the nest table. I am entering the table EKKN to get the account assignment data

http://www.sapafs.net

http://www.sapafs.net

9. Enter the Continue button. You will see all the tables we require with automatic joins

10. I am expanding the size of the tables in the display by dragging them by handles and adjusting sizes

http://www.sapafs.net

11. In the proposed links between the tables EKKO and EKPO there is a link which I do not require. I am removing the link between the last item number with the PO LI ( EKKO LPONR -> EKPO EBELP) 12. Right Click on the link and Select Remove Join Condition

http://www.sapafs.net

13. Now press Check Button. If there are any errors in linking that will be highlighted.

http://www.sapafs.net

14. You will see the result of the check in the bottom of your screen.

http://www.sapafs.net

15. Now hit the back button 16. You can limit the number of fields the InfoSet contain. But here I am going to include all the fields in the InfoSet 17. Select the Include all table fields button and press continue

18. Now you can see all the field groups which are created. When you click on them you will see all the fields each of them contain

http://www.sapafs.net

19. Now we can generate the InfoSet by hitting the Generate Button

http://www.sapafs.net

20. After this hit the Back Button 21. Now we have generated our InfoSet to be used in the query. Now we have to tell the system who can Change/Use this InfoSet 22. To do this Select the InfoSet you are going to assign and then Click the User Group Assignment Button 23. Select the User Group and press save. In this case I am going to assign my InfoSet to the user group DEMO we created in the beginning

http://www.sapafs.net

24. Now the step 2 is completed. Now we can write the query. Go back to the SAP Session Manager screen by hitting back button

http://www.sapafs.net

Step 3: Creation of InfoSet Query (Transaction SQ01) 1. Go to the transaction SQ01 2. If your user Group is not displayed already click other user groups button

3. Select the correct user group from the list and press Choose

http://www.sapafs.net

4. Now Give your query a name and press the button Create

5. System will prompt you with a selection screen containing InfoSets assigned to your user group. Select the one you are going to use and then press the button Choose. In this case I have only one InfoSet created earlier. I am selecting that for my query.

http://www.sapafs.net

6. Now you can give your query a neme and add some notes for references and hit the Save button

http://www.sapafs.net

7. Hit the Back Button to get to the Query Main screen 8. Now highlight the query you created and select the InfoSet query Button to cerate the query 9. Now you can select the fields which you want to use in Selection Criteria and fields which you need to Display In the Report By checking the Check Boxes near each field. You will see all the selection information to your right and to the bottom of your screen

10. I am selecting the Purchase order Number and the Purch group and release status from the header data. From the item level I am mainly selecting the LI number and the material and its description, PO quantity and the deletion indicator with the AFS indicator. From the Account assignment details I am selecting the Sales Order Number and the Sales Order line Item Number

http://www.sapafs.net

http://www.sapafs.net

http://www.sapafs.net

11. After selecting all your filtering and display fields press save to save your work and hit the back button to get back to the main screen

http://www.sapafs.net

12. Now you can select and press the execute button and to run the query

http://www.sapafs.net

13. Enter your filtering criteria and hit the execute button to run the report

14. Hooray ! Here It is. Our query is working fine

http://www.sapafs.net

15. Do changes to your query until you get your desired result and information out from it

http://www.sapafs.net

You might also like