Abap Query Tutorial
Abap Query Tutorial
Table of Contents
ADVANCED ABAP CONCEPT – ABAP QUERY 2
1. INTRODUCTION 2
2. ABAP QUERY 3
2.1 DEFINITION 3
2.2 CREATION OF ABAP QUERY 3
2.3 CASE SCENARIO 3
2.4 STEP BY STEP APPROACH 1
2.4.1 CREATE USER GROUP 1
2.4.2 CREATE INFOSET 2
2.4.3 CREATE ABAP QUERY 5
3. CONCLUSION 6
Page 1
ABAP Query
1. Introduction
1.1 Basics of ABAP
SAP (System Application & Products) is one of the best ERP Applications in the market. The
application has been assembled in such a versatile way that it handles the entire functional
department within an organization. Today major companies including Microsoft and IBM are using
SAP to run their own businesses.
A very high level programming language created by SAP is ABAP (Advanced Business Application
Programming) which is used to develop applications for SAP R/3 system, a widely-installed business
application subsystem. ABAP is thus not only a mature language that has proven itself in the
practical field, but – on the basis of its evolutionary strategy – it continues to be suited to the
requirements of business programming. With the quality of its application programs, it has made
SAP a world leader in the development of business software.
ABAP Query
ALE, IDOC
BADI
Logical Database
LSMW
SAP Workflow
Page 2
ABAP Query
2. ABAP Query
2.1 Definition
ABAP Query is a functional tool used to develop simple report by writing queries instead of writing
ABAP report program i.e. without ABAP coding. All you need is to join the table and drag and drop
field that you wish to occur in the report.
Create User Group (SQ03):- Specify the users who should be authorized to run the query.
Create Infoset (SQ02):- Indicates from which part of the SAP database the data is going to be
retrieved and how the data is to be retrieved by the query.
Create Queries (SQ01):- Create the query and arrange the layout.
Document Category
Document Type
Status
Payment Term
Material Number
Plant
Storage Location
Page 3
ABAP Query
All the above information is stored in the base tables EKKO (Purchasing Document Header)
and EKPO (Purchasing Document Item).
Once the user Group is created, users have to be assigned to this group. The users in the
group are only eligible to run the query. The below screen shows “DEV01” and “DEV02” users
are added to this user Group.
Page 1
ABAP Query
Navigate to SQ02. Give the name and click on “Create”. Provide the Title and the table
information in the fields provided as given in the below screen.
Till now EKKO table is only added in the infoset, now EKPO table has to be added by
clicking on “Insert Table” button in the below screen. Once both the tables are added, the
pictorial representation of the tables are represented as,
Page 2
ABAP Query
Select Fields: - This is achieved by clicking on “Infoset” Button on previous screen. Fields
are selected by simply dragging and dropping from left to right. Here we have selected only 6
fields from EKKO table and 5 fields from EKPO table.
Page 3
ABAP Query
Generate the Infoset by clicking on “Generate” Button. Once the infoset is generated it will
be displayed in the list with its status marked as “Green”.
Page 4
ABAP Query
Page 5
ABAP Query
Among the selected fields in the infoset, select the fields for outputting in the report as well
as selection condition can also be given for each and every field before the report is
generated. This is shown in the below screen,
Final report is generated by clicking on “Output” Button in the previous screen. This is the
sample report for Basic list similarly Statistical and Ranking list can be generated by
selecting the option from the dropdown provided in the previous screen.
Page 6
ABAP Query
3. Conclusion
This document gives brief introduction on ABAP concepts and stepwise approach to create
ABAP Query. It is basically a tool to test SQL query. It clearly depicts that, report program is
not needed to test the single SQL Query.
Page 7