© 2005 -2006 sapficoconsultant.com. All rights reserved. No part of this e-book should be reproduced or transmitted in any form, or by any means, electronic or mechanical including photocopying, recording or by any information storage retrieval sys tem without permission in writing from www.sapficoconsultant.com

“SAP” is a trademark of SAP AG, Neurottstrasse 16, 69190 Walldorf, Germany. SAP AG is not the publisher of this e-book and is not responsible for it under any aspect. Warning and Disclaimer This e-book is sold as is, without warranty of any kind, either express or implied. While every precaution has been taken in the preparation of this e-book, www.sapficoconsultant.com assumes no responsibility for errors or omissions. Neither is any liability assumed for damages resulting from the use of the information or instructions contained herein. It is further stated that the publisher is not responsible for any damage or loss to your data or your equipment that results directly or indirectly from your use of this e-book.

SAP Query

www.sapficoconsultant.com

TABLE OF CONTENT INTRODUCTION..............................................................................................................4 Scenario 1 .........................................................................................................................5 1. Finding Database tables for creating queries ......................................................5 2. Create a User group ..............................................................................................19 3. Create an Infoset....................................................................................................28 4. Assign Infoset to User Group ...............................................................................40 5. Create Query...........................................................................................................42 Scenario 2 .......................................................................................................................68 1. Creating an Infoset.................................................................................................69 2. Assign Infoset to User group ................................................................................90 3. Create a Query .......................................................................................................91

SAP Query

www.sapficoconsultant.com

SAP Query typically can handle only simple report requirements. 2nd scenario: Information required is spread in 2 different tables. Let us get going then. This kind of query is a very simple query. We have covered two scenarios for creating SAP Query: 1st scenario: All information is available in a single table.com . All data required by a user for a report can be read from various tables. SAP Query www. How do you find a table in SAP where the relevant information is available? We have explained how to go about finding the relevant tables. Thus you need to create a join between the 2 tables using a common field. Thus an SAP consultant does not have to depend on an ABAP programmer to get a report developed.INTRODUCTION SAP Query is a very powerful tool in SAP to get reports quickly without any programming knowledge.sapficoconsultant.

com . Finding Database tables for creating queries We want to view the accounting data (company code segment) of the all the customer masters in the company. To create an SAP query you need to know the database table where the information exists.Scenario 1 1. Therefore we feel the need to create an SAP Query. In this case it is FD03 Go to the company code data SAP Query www. Use the relevant transaction code to see the information. How can that be obtained? Option 1 We want to see the company code information of a customer.sapficoconsultant. Standard reports available do not give the desired information.

sapficoconsultant.com . account key F1 on the key board to see the field help.Position the cursor on the field Recon. and press function SAP Query www.

com .Click on Technical info SAP Query www.sapficoconsultant.

sapficoconsultant. Click on SAP Query www. Option 2 Sometimes the table name is not easily available as was available in option 1.Thus you get the Transparent table name – KNB1 Here you have easily got the table. In the same transaction close all the help screens.com .

sapficoconsultant.Click on the field Name keyboard and now again press function key F1 on the SAP Query www.com .

sapficoconsultant.com .Click on SAP Query www.

com .sapficoconsultant. Note down the field name NAME1 In another session type in transaction code SE90 in the command field. SAP Query www.In the above screen transparent table is not visible.

Click SAP Query www.com .sapficoconsultant.

com .sapficoconsultant.Click SAP Query www.

sapficoconsultant.Click SAP Query www.com .

com .sapficoconsultant.Double click SAP Query www.

sapficoconsultant.com .SAP Query www.

Update the following:- Click SAP Query www.sapficoconsultant.com .

Click down to find where customer table for general data appears SAP Query www.com .sapficoconsultant.

sapficoconsultant. 2. Create a User group Use the following path:SAP menu à Tools à ABAP Workbench à Utilities à SAP Query à SQ01 Queries SAP Query www.com .We will use the table KNA1 for General data in Customer Master.

Click SAP Query www.sapficoconsultant.com .

com .sapficoconsultant.SAP Query www.

com .sapficoconsultant.Update the following:- Click SAP Query www.

com .sapficoconsultant.Update the following:- Click Update the following:- Click on SAP Query www.

sapficoconsultant. Click on SAP Query www.Click Click on Click Assign users to the user group. You need to assign the users of the particular department to the user group.com .

com .You will update the relevant users who will be using these queries.sapficoconsultant. SAP Query www.

com .Click SAP Query www.sapficoconsultant.

Click on Click SAP Query www.sapficoconsultant.com .

3. Create an Infoset Click Environment à Infosets SAP Query www.sapficoconsultant.com .

com .sapficoconsultant.SAP Query www.

Update the following:- Click SAP Query www.com .sapficoconsultant.

Click SAP Query www.sapficoconsultant.com .

Update the following:- Click Click SAP Query www.sapficoconsultant.com .

sapficoconsultant.Click SAP Query www.com .

Click SAP Query www.com .sapficoconsultant.

sapficoconsultant.com . Position the cursor on Then position the cursor on SAP Query www.You will notice in the above screen that some fields have T above them This means that in this field text is also a vailable. Now we need to select fields from the table (left hand side) to the Field Group/data fields (right hand side).

Click on Insert field(s) in field group SAP Query www.sapficoconsultant.com .

Click Hold the Ctrl key on the keyboard and select other fields also By clicking Click SAP Query www.com .sapficoconsultant.

sapficoconsultant.Click Click on SAP Query www.com .

Here you can save to the existing request or create a new request. We will save to the same request.sapficoconsultant. Click SAP Query www.com . Click Click to generate the infoset The infoset is now ready to use in the query.

sapficoconsultant.4. Assign Infoset to User Group Update the following:- Click SAP Query www.com .

sapficoconsultant.com .Select Click Click SAP Query www.

Click to select user group SAP Query www.sapficoconsultant.com .5. Create Query Here we maintain the source fields which are to be updated with the data.

Select Click SAP Query www.com .sapficoconsultant.

sapficoconsultant.com .Update the following:- Click SAP Query www.

sapficoconsultant.com .Click SAP Query www.

SAP Query www.sapficoconsultant.com .

Update the following:- Click SAP Query www.com .sapficoconsultant.

Select Click SAP Query www.sapficoconsultant.com .

com .sapficoconsultant.SAP Query www.

com .Update the following:- Click SAP Query www.sapficoconsultant.

com .SAP Query www.sapficoconsultant.

sapficoconsultant.com .Click SAP Query www.

sapficoconsultant.SAP Query www.com .

Update the following:- Click Click SAP Query www.com .sapficoconsultant.

Click SAP Query www.sapficoconsultant.com .

Double click SAP Query www.com .sapficoconsultant.

com .Click SAP Query www.sapficoconsultant.

com .Double click Similarly double click other fields to select SAP Query www.sapficoconsultant.

Click SAP Query www.com .sapficoconsultant.

SAP Query www.com .sapficoconsultant.

Update the following:- Click SAP Query www.com .sapficoconsultant.

com .sapficoconsultant.Click SAP Query www.

com .Update the following:- Click In the above screen shot you see that the Customer text is being showing as Customer number. We need to change this. Click twice SAP Query www.sapficoconsultant.

com .sapficoconsultant.Click SAP Query www.

sapficoconsultant.Click the field will open up Change it to Customer Name SAP Query www.com .

com .sapficoconsultant.Click on Click SAP Query www.

Click Click Click on Click twice until you reach SAP Query www.com .sapficoconsultant.

sapficoconsultant.com . SAP Query www. where in all information required was available in a single table. But that is not the case always. In such a scenario you need to create a join between these tables through a common field between these tables. Information which we require is not available in a single table and is scattered across in more than one table.Now you can execute this query By selecting Click Scenario 2 In scenario 1 we saw a simple query.

Let us proceed with creating a new query 1. Creating an Infoset SAP Query www. We have seen earlier that the customer address information is available in the table KNA1 and the accounting information for the customer is available in the table KNB1. These 2 tables can be joined based on the common field customer number in them.sapficoconsultant.com .In this scenario we want to have information of the customer master with name. address and also the accounting information.

Update the following:- Click SAP Query www.com .sapficoconsultant.

SAP Query www.com .sapficoconsultant.

com .Update the following:- Click SAP Query www.sapficoconsultant.

sapficoconsultant.com .Click Update the following:- Click Click SAP Query www.

com .sapficoconsultant.Click Click Click SAP Query www.

sapficoconsultant.Select Click on Settings à Settings SAP Query www.com .

Click Select Now click SAP Query www.com .sapficoconsultant.

com .sapficoconsultant.Click SAP Query www.

com .sapficoconsultant.Position the cursor on Click Undo relationship SAP Query www.

Click Click SAP Query www.com .sapficoconsultant.

Now Update the following:- SAP Query www.sapficoconsultant.com .

com .Click SAP Query www.sapficoconsultant.

Click SAP Query www.com .sapficoconsultant.

Click SAP Query www.com .sapficoconsultant.

sapficoconsultant.Click SAP Query www.com .

sapficoconsultant.com .Click Click SAP Query www.

com . Press the Ctrl button to select more than one field. Click Click SAP Query www.sapficoconsultant.Click Thereafter select all the fields you want to move on the right side.

Click until you will see Select the following fields SAP Query www.com .sapficoconsultant.

Select

Click

SAP Query

www.sapficoconsultant.com

Click

Click on Click Click

Click

SAP Query

www.sapficoconsultant.com

2. Assign Infoset to User group

Click

SAP Query

www.sapficoconsultant.com

com .Select Click Click twice 3.sapficoconsultant. Create a Query Click Other user group SAP Query www.

com .sapficoconsultant.Click Click Click SAP Query www.

com .Uncheck SAP Query www.sapficoconsultant.

Update the following:- Click SAP Query www.sapficoconsultant.com .

com .sapficoconsultant.Double click SAP Query www.

sapficoconsultant.Update the following:- SAP Query www.com .

com .Click SAP Query www.sapficoconsultant.

sapficoconsultant.com .Select Click SAP Query www.

com .sapficoconsultant.Select SAP Query www.

Click SAP Query www.com .sapficoconsultant.

com .sapficoconsultant.Click SAP Query www.

sapficoconsultant.com .SAP Query www.

Click SAP Query www.sapficoconsultant.com .

sapficoconsultant.Update the following:- SAP Query www.com .

com .Click SAP Query www.sapficoconsultant.

sapficoconsultant.SAP Query www.com .

Click SAP Query www.sapficoconsultant.com .

sapficoconsultant.SAP Query www.com .

sapficoconsultant.com .Click SAP Query www.

Click SAP Query www.sapficoconsultant.com .

Create as many queries as you want. SAP Query www.com .sapficoconsultant.Click Click on Click twice thrice To execute a query Select And then Click Congrats. You are now able to create a report (Query) on your own. All the best.